Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's Collapsing Forums Block
Author Message
horrorcode
Involved
Involved


Joined: Jan 17, 2009
Posts: 272
Location: Missouri

PostPosted: Thu Jan 29, 2009 2:27 am Reply with quote

Didnt really want to open a new topic but than saw how many exist for the block so here goes.

I used the Top Users Points block and noted what was needed to apply this, sorry but Im making this simple so I dont drag on, this isnt a future request but it could easily be added.
Live preview(note my other changes):
Only registered users can see links on this board! Get registered or login!

EDIT: It changed the code here so you should probably read these instructions too.
Full instructions can be read:
Only registered users can see links on this board! Get registered or login!

Notice in the instructions all nbsp's were converted, so that needs to be considered. Very simple edits just add "points," before user_avatar, so the new code would look like this:

Code:
$sql = "SELECT user_id, username, user_posts, points, user_avatar,


and

Code:
while(list($user_id, $username, $user_posts, $points, $user_avatar,


Than I just threw it before Posts: so it wouldnt take forever, so that section(for me) looks like this:

Code:
<br />Points:&nbsp;<!--a href=\"profile-.html$user_id\" 

 $staffTitle-->$points<!--/a-->&nbsp;&nbsp;&nbsp;&nbsp;<br /><!--a
href=\"forums.html?file=search&mode=results&search_author=$username\"
 $staffTitle-->Posts:<!--/a-->


Hopefully you can figure out the "nbsp" and maybe someone here can come up with a better way of doing this, I know I didnt enclose the "Points:" in "<!--a href=""-->" but I didn't see it as needed. So an explanation on that for a non-link would also be great.

Anyways, hope you like Very Happy
 
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Thu Feb 05, 2009 12:57 am Reply with quote

I just caught up with this - sorry! I think that's a nice mod. I don't use points but I know there are many who do. I don't know if you added this as an optional setting but that's how I would add it. Something like:

$showTopPostersPoints = true; // true=yes - false=no

Thanks!
 
View user's profile Send private message
horrorcode
PostPosted: Thu Feb 05, 2009 6:41 am Reply with quote

Thanks, I took what you said and went with it, took me a couple hours but hows this..

I started by adding exactly what you gave me, in between Ranks and Num so it looks like this:

Code:


$showTopPostersRanks       = 4;  // 0=None, 1=Admin only, 2=Moderator only, 3=Admin and Moderator, 4=All
$showTopPostersPoints      = TRUE; // true=yes - false=no
$showTopPostersNum         = 5;  // Total number of top posters to show


Than you still need to add the "points" so it looks like this:

Code:
$sql = "SELECT user_id, username, user_posts, points, user_avatar,


and this:

Code:
while(list($user_id, $username, $user_posts, $points, $user_avatar,


Next what took me the longest is figuring out to add the if statement and I'm not sure if its proper but heres what I did

In the end of this line:
Code:
$content .= "&nbsp;<!--a href=\"fsearch-results.html?search_author=$username\" $staffTitle-->$user_posts<!--/a-->&nbsp;<br />";


the only way I could get it to display correctly is to change the "</td>" to the "<br />"...problem here is where else can I add the td, I tried an if statement and it wont work here, I added this on the next line so it looks like:

Code:
      $content .= "<td align=\"center\">&nbsp;<a href=\"forum-userprofile-.html$user_id\" $staffTitle><b>$username</b></a>&nbsp;<br />&nbsp;<!--a href=\"fsearch-results.html?search_author=$username\" $staffTitle-->Posts:<!--/a-->";

      $content .= "&nbsp;<!--a href=\"fsearch-results.html?search_author=$username\" $staffTitle-->$user_posts<!--/a-->&nbsp;<br />";
      if ($showTopPostersPoints) {
      $content .= "&nbsp;<!--a href=\"fsearch-results.html?search_author=$username\" $staffTitle-->Points:<!--/a-->&nbsp;<!--a href=\"forum-userprofile-.html$user_id\" $staffTitle-->$points<!--/a-->&nbsp;</td>";
      }
      if (!($cycle%$showTopPostersPerRow)) $content .= "</tr>";
      $cycle++;


And you can see it here: Only registered users can see links on this board! Get registered or login!

After changing it to false it still works, but is it a problem that the td tag isnt closed in that line or is it closing anyways? Also, this is the original block if you want me to post it let me know, the way I had it before was totally different.. I couldnt figure out how to get the avatars and everything in one row without making signifigant changes.
 
trunks
Worker
Worker


Joined: Oct 05, 2007
Posts: 152
Location: United Kingdom

PostPosted: Thu Feb 05, 2009 8:41 am Reply with quote

Great development of such a useful block created by raven! I know i personally use it and i also make great use of the points system, so its definatly a +++ for me to have. I think it will also add another level of interaction with both site and users themselves.

Nice work horror,

Trunks
 
View user's profile Send private message Visit poster's website MSN Messenger
horrorcode
PostPosted: Thu Feb 26, 2009 8:32 pm Reply with quote

Looks like this got lost lol... Has anyone tested this out? I still havent figured out what to do about that td tag, but maybe it would be ok on the next line after $cycle? Which would be here:

Code:
      if ($showTopPostersPoints) {

      $content .= "&nbsp;<!--a href=\"fsearch-results.html?search_author=$username\" $staffTitle-->Points:<!--/a-->&nbsp;<!--a href=\"forum-userprofile-.html$user_id\" $staffTitle-->$points<!--/a-->&nbsp;</td>";
      }

      if (!($cycle%$showTopPostersPerRow)) $content .= "</tr>";
      $cycle++;
   }

   $content .= "</table></div><br />";
}


The br would stay where td was changed in the previous post, but the td would be moved to after the tr, which might be a problem. But maybe it could also be in that if statement before the tr.
 
trunks
PostPosted: Fri Feb 27, 2009 4:30 pm Reply with quote

What is it your trying to achieve there horror?
 
horrorcode
PostPosted: Fri Feb 27, 2009 6:35 pm Reply with quote

Just compliance really, need to make sure it validates properly but need someone to test it.
 
horrorcode
PostPosted: Sat Feb 28, 2009 1:22 am Reply with quote

I think it would be best to just add td between the 2 if statements, so it would look like this:

Code:
      if ($showTopPostersPoints) {

      $content .= "&nbsp;<!--a href=\"forums.html?file=search&mode=results&search_author=$username\" $staffTitle-->Points:<!--/a-->&nbsp;<!--a href=\"profile-.html$user_id\" $staffTitle-->$points<!--/a-->&nbsp;";
      }
     $content .= "</td>";
      if (!($cycle%$showTopPostersPerRow)) $content .= "</tr>";
      $cycle++;
   }

   $content .= "</table></div><br />";
}


Then this is done, just need a tester now.

Edit: I think we can call this finished I went ahead and tested it and it seems fine. Ill compress and post soon, on linux right now so not having the best time navigating through my ntfs clutter. Bang Head
 
trunks
PostPosted: Sat Feb 28, 2009 1:48 pm Reply with quote

Well hit me up on msn and we'll get this tested for you... compile it as a seperate block for time's sake for now Smile

-Trunks
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's Collapsing Forums Block

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©