Show reputation on portal page
#11
I'll see what I can do.. Not sure how the portal works though, i personally never use it and never coded for it before Wink.
I don't think it should be that hard Wink.
I'm arranging my site a bit and then i'll check what I can do

- Shadows.
[Image: modmybb-banner-0.png]
If you think I've helped you; a + rep would be appreciated.
Reply
#12
I'm sure you can do it Smile
Portfolio - Plum
Reply
#13
EDIT: Got it to work!
It's done, just got to release it now!

You can get it here
http://forums.geekhelps.net/showthread.php?tid=26
will release it later on mybb mods section as i have to go sleep ASAP, got to wake up soon..

- Shadows.
[Image: modmybb-banner-0.png]
If you think I've helped you; a + rep would be appreciated.
Reply
#14
Hi, is possible to get/to give reputation also on announcements on portal?
Thanks
Reply
#15
For give reputation, add in the portal_announcement templates:

<a href="javascript:void(0)" onclick="MyBB.reputation({$announcement['uid']},{$announcement['pid']}); return false;">Give Reputation</a>

To get reputation you need an edit in the portal.php file or a plugin. The plugin actually I can't do it for you, but if you are interested in the edit:

Open the portal.php file.

Search this query:

$query = $db->query("
	SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
	WHERE t.tid IN (0{$tids}){$annfidswhere}{$tunviewwhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
	ORDER BY t.dateline DESC
	LIMIT 0, {$numannouncements}"
);

Add at the end of the SELECT statement u.reputation, in this manner:

$query = $db->query("
	SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions, u.reputation
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
	WHERE t.tid IN (0{$tids}){$annfidswhere}{$tunviewwhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
	ORDER BY t.dateline DESC
	LIMIT 0, {$numannouncements}"
);

Then search:

$announcement['threadusername'] = htmlspecialchars_uni($announcement['threadusername']);

And add after:

$announcement['userrep'] = get_reputation($announcement['reputation'], $announcement['uid']);

Now to get the reputation use in the portal_announcement templates:

{$announcement['userrep']}
Reply
#16
(2017-05-29, 12:21 PM)Mipher Wrote: For give reputation, add in the portal_announcement templates:

<a href="javascript:void(0)" onclick="MyBB.reputation({$announcement['uid']},{$announcement['pid']}); return false;">Give Reputation</a>

To get reputation you need an edit in the portal.php file or a plugin. The plugin actually I can't do it for you, but if you are interested in the edit:

Thank you very much Mipher! It works perfectly, thank you very much :* :*

And another question, if possible: do you know if there is the variable for hook a single portal_announcement?

For example for postbits there is "pid", for portal_announcement there is a similar thing?

Thank you again
Reply
#17
Portal Announcements are connected with pid (post id), so you can hook them specifying the post id with:

{$announcement['pid']}

If you want to create something that separate pid with announcements, something like:
  • First Announcement: 1
  • Second Announcement: 2
  • Third Announcement: 3
  • etc..

You can make this edit on the portal.php file:

Search:

while($announcement = $db->fetch_array($query))

Add before:

$i = $query->num_rows;

Search:

$announcement['message'] = $posts[$announcement['tid']]['message'];

Add before:

$announcement['aid'] = $i--;


And in the portal_announcement templates use:

{$announcement['aid']}
Reply
#18
Thank you very much Mipher!! Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)