The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Problem with member of the month javascript code

View previous topic View next topic Go down

Solved Problem with member of the month javascript code

Post by Van-Helsing on March 2nd 2015, 2:50 am

Hello,
I am trying to install the below code for Member Of The Month in board index but it is not displaying anything and I can't locate what is going wrong. Can you help me please to fix it?

Code:

      $(document).ready(function(){
          function makeArray() {
              for (i = 0; i<makeArray.arguments.length; i++)
              this[i + 1] = makeArray.arguments[i];
          }
          var months = new makeArray('Ιανουαρίου','Φεβρουαρίου','Μαρτίου','Απριλίου','Μαΐου','Ιουνίου','Ιουλίου','Αυγούστου','Σεπτεμβρίου','Οκτωβρίου','Νοεμβρίου','Δεκεμβρίου');
          var date = new Date();
          var month = date.getMonth() + 1;
          var yy = date.getYear();
          var year = (yy < 1000) ? yy + 1900 : yy;
          var link = $('.module table[summary="Most active topic starters"] td:eq(0) a').attr('href');
          $.get(link, function(d) {
          var nome = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) strong', d).text();
          var avatar = jQuery('#profile-advanced-right .main-content.clearfix.center:eq(0) img', d).attr('src');
          var register = jQuery('#field_id-4 dd', d).text();
          var posts = jQuery('#field_id-6 dd', d).text();
          var pontos = jQuery('#field_id-14 dd', d).text();
          var rep_m = jQuery('#field_id-13 dd', d).text();
          var id = link.match(/\d+/g);
          var verify = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) em', d).text();
          if(verify == '(Συνδεδεμένος)') {
            var status = 'online';
          }else {
            var status = 'offline';
          }
        var p = $('.pun-crumbs')[0];
        $(p).after('
        <div class="main destaque" style="display: none;">
        <div class="main-head">
              <div class="page-title" style="padding: 3px 6px 3px;">
                    <h2><img src="http://i.imgur.com/fHukYSL.png" /> Μέλος του Μήνα</h2>
              </div>
        </div>
        <div class="main-content">
        <table>
        <tbody class="statused">
                                    <tr>
        <td width="105px" align="center" style="background-color: aliceBlue;padding: 3px;">
                    <img src="'+avatar+'" class="avatar_d" alt="'+avatar+'" /><br><br>
                    <span class="bs_badge" style="background:green;margin-bottom:3px;margin-top:3px;"><a href="/privmsg?mode=post&u='+id+'">Αποστολή Π.Μ</a></span><br>
                    <span class="bs_badge" style="background:green;"><a href="/spa/'+nome+'">Θέματα</a></span>
                </td>
        <td>
        <div style="position:relative;left:-5px;padding:5px 0px 5px 15px;">
                      <div style="border-bottom:1px solid lightgrey;padding-bottom:3px;">
                          <h4><span style="font-size:1.3em;">'+nome+'</span>
                          <span style="float:right;color:grey;font-size:10px;position:relative;" class="m_o_m"></span></h4>
                          </div>

        <span>
        <p class="message_motm" style="padding-top:3px"></p>
        <div style="padding:5px;float:right">
        <span class="bs_badge reset_cursor" id="m_post"></span>
        <span class="bs_badge reset_cursor" id="m_rep"></span>
        <span class="bs_badge bs_badge_lightgrey reset_cursor perf"><a href="'+link+'">Δείτε το προφίλ</a></span>
        </div>
        </span>
        </div>
        </td>
              </tr>
        </tbody>
        </table>
        </div>
        </div>
        ');
        if(link) {$('.destaque').show();}
        $('p.message_motm').html('Συγχαρητήρια στον/την '+nome+' το νεότερο μέλος του μήνα - <strong>'+months[month]+' - '+year+'</strong>. Έχει εγγραφεί στο φόρουμ στις '+register+'. Έχει δημοσιεύσει συνολικά '+posts+' θέματα. Έχει λάβει συνολικά '+pontos+' βαθμούς. Έχει λάβει '+rep_m+' "Ευχαριστώ. Τώρα είναι '+status+'.');
        $('.m_o_m').html('Μέλος του Μήνα:  <span class="bs_badge" style="background:green;">'+months[month]+' - '+year+'</span>');
        $('#m_post').html(''+posts+' θέματα');
        $('#m_rep').html(''+rep_m+' "Ευχαριστώ"');
        });
        });


Last edited by Black-Shadow on March 5th 2015, 12:18 am; edited 1 time in total

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by _Twisted_Mods_ on March 2nd 2015, 4:12 am

try this

Code:

          $(document).ready(function(){
              function makeArray() {
                  for (i = 0; i<makeArray.arguments.length; i++)
                  this[i + 1] = makeArray.arguments[i];
              }
              var months = new makeArray('Ιανουαρίου','Φεβρουαρίου','Μαρτίου','Απριλίου','Μαΐου','Ιουνίου','Ιουλίου','Αυγούστου','Σεπτεμβρίου','Οκτωβρίου','Νοεμβρίου','Δεκεμβρίου');
              var date = new Date();
              var month = date.getMonth() + 1;
              var yy = date.getYear();
              var year = (yy < 1000) ? yy + 1900 : yy;
              var link = $('.module table[summary="Most active topic starters"] td:eq(0) a').attr('href');
              $.get(link, function(d) {
              var nome = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) strong', d).text();
              var avatar = jQuery('#profile-advanced-right .main-content.clearfix.center:eq(0) img', d).attr('src');
              var register = jQuery('#field_id-4 dd', d).text();
              var posts = jQuery('#field_id-6 dd', d).text();
              var pontos = jQuery('#field_id-14 dd', d).text();
              var rep_m = jQuery('#field_id-13 dd', d).text();
              var id = link.match(/\d+/g);
              var verify = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) em', d).text();
              if(verify == '(Συνδεδεμένος)') {
                var status = 'online';
              }else {
                var status = 'offline';
              }
            var p = $('.pun-crumbs')[0];
            $(p).after('<div class="main destaque" style="display: none;"><div class="main-head"><div class="page-title" style="padding: 3px 6px 3px;"><h2><img src="http://i.imgur.com/fHukYSL.png" /> Μέλος του Μήνα</h2></div></div><div class="main-content"><table><tbody class="statused"><tr><td width="105px" align="center" style="background-color: aliceBlue;padding: 3px;"><img src="'+avatar+'" class="avatar_d" alt="'+avatar+'" /><br><br><span class="bs_badge" style="background:green;margin-bottom:3px;margin-top:3px;"><a href="/privmsg?mode=post&u='+id+'">Αποστολή Π.Μ</a></span><br><span class="bs_badge" style="background:green;"><a href="/spa/'+nome+'">Θέματα</a></span></td><td><div style="position:relative;left:-5px;padding:5px 0px 5px 15px;"><div style="border-bottom:1px solid lightgrey;padding-bottom:3px;"><h4><span style="font-size:1.3em;">'+nome+'</span><span style="float:right;color:grey;font-size:10px;position:relative;" class="m_o_m"></span></h4></div><span><p class="message_motm" style="padding-top:3px"></p><div style="padding:5px;float:right"><span class="bs_badge reset_cursor" id="m_post"></span><span class="bs_badge reset_cursor" id="m_rep"></span><span class="bs_badge bs_badge_lightgrey reset_cursor perf"><a href="'+link+'">Δείτε το προφίλ</a></span></div></span></div></td></tr></tbody></table></div></div>');
            if(link) {$('.destaque').show();}
            $('p.message_motm').html('Συγχαρητήρια στον/την '+nome+' το νεότερο μέλος του μήνα - <strong>'+months[month]+' - '+year+'</strong>. Έχει εγγραφεί στο φόρουμ στις '+register+'. Έχει δημοσιεύσει συνολικά '+posts+' θέματα. Έχει λάβει συνολικά '+pontos+' βαθμούς. Έχει λάβει '+rep_m+' "Ευχαριστώ. Τώρα είναι '+status+'.');
            $('.m_o_m').html('Μέλος του Μήνα:  <span class="bs_badge" style="background:green;">'+months[month]+' - '+year+'</span>');
            $('#m_post').html(''+posts+' θέματα');
            $('#m_rep').html(''+rep_m+' "Ευχαριστώ"');
            });
            });

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by Van-Helsing on March 2nd 2015, 9:25 am

@_Twisted_Mods_ wrote:try this

Code:

          $(document).ready(function(){
              function makeArray() {
                  for (i = 0; i<makeArray.arguments.length; i++)
                  this[i + 1] = makeArray.arguments[i];
              }
              var months = new makeArray('Ιανουαρίου','Φεβρουαρίου','Μαρτίου','Απριλίου','Μαΐου','Ιουνίου','Ιουλίου','Αυγούστου','Σεπτεμβρίου','Οκτωβρίου','Νοεμβρίου','Δεκεμβρίου');
              var date = new Date();
              var month = date.getMonth() + 1;
              var yy = date.getYear();
              var year = (yy < 1000) ? yy + 1900 : yy;
              var link = $('.module table[summary="Most active topic starters"] td:eq(0) a').attr('href');
              $.get(link, function(d) {
              var nome = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) strong', d).text();
              var avatar = jQuery('#profile-advanced-right .main-content.clearfix.center:eq(0) img', d).attr('src');
              var register = jQuery('#field_id-4 dd', d).text();
              var posts = jQuery('#field_id-6 dd', d).text();
              var pontos = jQuery('#field_id-14 dd', d).text();
              var rep_m = jQuery('#field_id-13 dd', d).text();
              var id = link.match(/\d+/g);
              var verify = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) em', d).text();
              if(verify == '(Συνδεδεμένος)') {
                var status = 'online';
              }else {
                var status = 'offline';
              }
            var p = $('.pun-crumbs')[0];
            $(p).after('<div class="main destaque" style="display: none;"><div class="main-head"><div class="page-title" style="padding: 3px 6px 3px;"><h2><img src="http://i.imgur.com/fHukYSL.png" /> Μέλος του Μήνα</h2></div></div><div class="main-content"><table><tbody class="statused"><tr><td width="105px" align="center" style="background-color: aliceBlue;padding: 3px;"><img src="'+avatar+'" class="avatar_d" alt="'+avatar+'" /><br><br><span class="bs_badge" style="background:green;margin-bottom:3px;margin-top:3px;"><a href="/privmsg?mode=post&u='+id+'">Αποστολή Π.Μ</a></span><br><span class="bs_badge" style="background:green;"><a href="/spa/'+nome+'">Θέματα</a></span></td><td><div style="position:relative;left:-5px;padding:5px 0px 5px 15px;"><div style="border-bottom:1px solid lightgrey;padding-bottom:3px;"><h4><span style="font-size:1.3em;">'+nome+'</span><span style="float:right;color:grey;font-size:10px;position:relative;" class="m_o_m"></span></h4></div><span><p class="message_motm" style="padding-top:3px"></p><div style="padding:5px;float:right"><span class="bs_badge reset_cursor" id="m_post"></span><span class="bs_badge reset_cursor" id="m_rep"></span><span class="bs_badge bs_badge_lightgrey reset_cursor perf"><a href="'+link+'">Δείτε το προφίλ</a></span></div></span></div></td></tr></tbody></table></div></div>');
            if(link) {$('.destaque').show();}
            $('p.message_motm').html('Συγχαρητήρια στον/την '+nome+' το νεότερο μέλος του μήνα - <strong>'+months[month]+' - '+year+'</strong>. Έχει εγγραφεί στο φόρουμ στις '+register+'. Έχει δημοσιεύσει συνολικά '+posts+' θέματα. Έχει λάβει συνολικά '+pontos+' βαθμούς. Έχει λάβει '+rep_m+' "Ευχαριστώ. Τώρα είναι '+status+'.');
            $('.m_o_m').html('Μέλος του Μήνα:  <span class="bs_badge" style="background:green;">'+months[month]+' - '+year+'</span>');
            $('#m_post').html(''+posts+' θέματα');
            $('#m_rep').html(''+rep_m+' "Ευχαριστώ"');
            });
            });
Hello @_Twisted_Mods_,
Its still not working Sad

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by _Twisted_Mods_ on March 2nd 2015, 3:13 pm

do you have the Most active topic starters widget on your forum active?

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by Van-Helsing on March 2nd 2015, 3:42 pm

@_Twisted_Mods_ wrote:do you have the Most active topic starters widget on your forum active?

Hello @_Twisted_Mods_,
Yes but I have modified it due the recent topics system v5, on my testing forum i haven't the recent topics systems and i havent most active starters widget active in both cases it is not working.
Is there a way to retrieve the data from recent topics system v5?

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by _Twisted_Mods_ on March 2nd 2015, 3:49 pm

no idea of what system your talking about

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by Van-Helsing on March 2nd 2015, 6:02 pm

@_Twisted_Mods_,
Here is the Recent Topics System :



and it must retrieve the member of the month as the red arrows showing.
@_Twisted_Mods_ is there a way to get the data from the member of the month widget?

I want to make this:


@_Twisted_Mods_ can we adapt the widget Member of the month code for the main page message code?


Last edited by Black-Shadow on March 4th 2015, 10:32 am; edited 1 time in total

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by Van-Helsing on March 3rd 2015, 7:45 pm

Bump

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by Van-Helsing on March 4th 2015, 11:11 pm

Bump

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by _Twisted_Mods_ on March 4th 2015, 11:18 pm

Code:

              $(document).ready(function(){
                  function makeArray() {
                      for (i = 0; i<makeArray.arguments.length; i++)
                      this[i + 1] = makeArray.arguments[i];
                  }
                  var months = new makeArray('Ιανουαρίου','Φεβρουαρίου','Μαρτίου','Απριλίου','Μαΐου','Ιουνίου','Ιουλίου','Αυγούστου','Σεπτεμβρίου','Οκτωβρίου','Νοεμβρίου','Δεκεμβρίου');
                  var date = new Date();
                  var month = date.getMonth() + 1;
                  var yy = date.getYear();
                  var year = (yy < 1000) ? yy + 1900 : yy;
                  var link = $('#top_posters li:eq(1) a').attr('href');
                  $.get(link, function(d) {
                  var nome = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) strong', d).text();
                  var avatar = jQuery('#profile-advanced-right .main-content.clearfix.center:eq(0) img', d).attr('src');
                  var register = jQuery('#field_id-4 dd', d).text();
                  var posts = jQuery('#field_id-6 dd', d).text();
                  var pontos = jQuery('#field_id-14 dd', d).text();
                  var rep_m = jQuery('#field_id-13 dd', d).text();
                  var id = link.match(/\d+/g);
                  var verify = jQuery('#profile-advanced-right .module .main-head .h3:eq(0) em', d).text();
                  if(verify == '(Συνδεδεμένος)') {
                    var status = 'online';
                  }else {
                    var status = 'offline';
                  }
                var p = $('.pun-crumbs')[0];
                $(p).after('<div class="main destaque" style="display: none;"><div class="main-head"><div class="page-title" style="padding: 3px 6px 3px;"><h2><img src="http://i.imgur.com/fHukYSL.png" /> Μέλος του Μήνα</h2></div></div><div class="main-content"><table><tbody class="statused"><tr><td width="105px" align="center" style="background-color: aliceBlue;padding: 3px;"><img src="'+avatar+'" class="avatar_d" alt="'+avatar+'" /><br><br><span class="bs_badge" style="background:green;margin-bottom:3px;margin-top:3px;"><a href="/privmsg?mode=post&u='+id+'">Αποστολή Π.Μ</a></span><br><span class="bs_badge" style="background:green;"><a href="/spa/'+nome+'">Θέματα</a></span></td><td><div style="position:relative;left:-5px;padding:5px 0px 5px 15px;"><div style="border-bottom:1px solid lightgrey;padding-bottom:3px;"><h4><span style="font-size:1.3em;">'+nome+'</span><span style="float:right;color:grey;font-size:10px;position:relative;" class="m_o_m"></span></h4></div><span><p class="message_motm" style="padding-top:3px"></p><div style="padding:5px;float:right"><span class="bs_badge reset_cursor" id="m_post"></span><span class="bs_badge reset_cursor" id="m_rep"></span><span class="bs_badge bs_badge_lightgrey reset_cursor perf"><a href="'+link+'">Δείτε το προφίλ</a></span></div></span></div></td></tr></tbody></table></div></div>');
                if(link) {$('.destaque').show();}
                $('p.message_motm').html('Συγχαρητήρια στον/την '+nome+' το νεότερο μέλος του μήνα - <strong>'+months[month]+' - '+year+'</strong>. Έχει εγγραφεί στο φόρουμ στις '+register+'. Έχει δημοσιεύσει συνολικά '+posts+' θέματα. Έχει λάβει συνολικά '+pontos+' βαθμούς. Έχει λάβει '+rep_m+' "Ευχαριστώ. Τώρα είναι '+status+'.');
                $('.m_o_m').html('Μέλος του Μήνα:  <span class="bs_badge" style="background:green;">'+months[month]+' - '+year+'</span>');
                $('#m_post').html(''+posts+' θέματα');
                $('#m_rep').html(''+rep_m+' "Ευχαριστώ"');
                });
                });

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by Van-Helsing on March 5th 2015, 12:12 am

Hello @_Twisted_Mods_,
Ok I solved it, Thank you very much.
~1~
i change this code

Code:
$('#top_posters li:eq(1) a').attr('href');

with this code
Code:

$('#top_posters li:eq(0) a').attr('href');
I think the counting in arrays in js starting from 0 position.

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Problem with member of the month javascript code

Post by _Twisted_Mods_ on March 5th 2015, 12:27 am

Topic solved and archived

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum