Support ⇒ Modules & Blocks ⇒ Kudos - AddOn ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexModules & Blocks

Kudos - AddOn Reply to topic

Go to page Previous 1, 2, 3 Next

The changes that Greenday posted for Forums Pro do actually work in the current standard forums too, as in I added the changes, and Kudos is now incrementing when people post.

Its prob better to find the proper ver 2 class changes though, as now when we post we get a scary white page like nothing is happening for a few seconds, then the post appears like normal.

Something not quite right I guess.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Ok, I've got this to display in the forums now, just can't work out how to make the links right.

The URLS from the your account page are thus,

'U_UP_1' => getlink('Kudos&op=credit&user_id='.$user_id.'&amount=1'),
'U_UP_2' => getlink('Kudos&op=credit&user_id='.$user_id.'&amount=2'),
'U_KUDOS' => getlink('Kudos'),
'U_DOWN_2' => getlink('Kudos&op=credit&user_id='.$user_id.'&amount=-2'),
'U_DOWN_1' => getlink('Kudos&op=credit&user_id='.$user_id.'&amount=-1'),

I need to add those to the viewtopic.php page, so that the userids are correct and cant quite figure out how to get the posterid as userid?

www.junglewraiths.net/...8715#48715

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Ok, couldn't figure out the links, so i cheated and added them in the viewtopic template instead, and its working in the forums now. Big grin

Modify Modules/Forums/viewtopic.php like thus.

Around line 27 add

require_once('language/english/kudos.php');

Around Line 565 add

'C_ALTER1' => can_admin('Kudos') ? 1 : $MAIN_CFG['kudos']['kudos_max'] > 0 ? 1 : '', 'C_ALTER2' => can_admin('Kudos') ? 1 : $MAIN_CFG['kudos']['kudos_max'] > 1 ? 1 : '', 'I_UP_1' => 'themes/'.$CPG_SESS['theme'].'/images/kudos/up1.png', 'I_UP_2' => 'themes/'.$CPG_SESS['theme'].'/images/kudos/up2.png', 'I_KUDOS' => 'themes/'.$CPG_SESS['theme'].'/images/kudos/kudos.png', 'I_DOWN_2' => 'themes/'.$CPG_SESS['theme'].'/images/kudos/down2.png', 'I_DOWN_1' => 'themes/'.$CPG_SESS['theme'].'/images/kudos/down1.png', 'U_KUDOS' => getlink('Kudos'), 'C_USER' => is_user() ? 1 : '',

around line 1213 add

'POSTERID' => $poster_id,

Now in Themes/Your Theme/templates/forums/viewtopic.html add the following wherever you want to display the buttons.

<!-- IF C_USER --> <!-- IF C_ALTER1 --> <a href="index.php?name=Kudos&op=credit&user_id={postrow.POSTERID}&amount=1"><img src="{I_UP_1}" alt="[+1]" title="_(K_UP_1)" border="0" /></a> <!-- IF C_ALTER2 --><a href="index.php?name=Kudos&op=credit&user_id={postrow.POSTERID}&amount=2"><img src="{I_UP_2}" alt="[+2]" title="_(K_UP_2)" border="0" /></a><!-- ENDIF --> <a href="{U_KUDOS}"><img src="{I_KUDOS}" alt="(K)" title="_(KUDOS)" border="0" /></a> <!-- IF C_ALTER2 --><a href="index.php?name=Kudos&op=credit&user_id={postrow.POSTERID}&amount=-2"><img src="{I_DOWN_2}" alt="[-2]" title="_(K_DOWN_2)" border="0" /></a><!-- ENDIF --> <a href="index.php?name=Kudos&op=credit&user_id={postrow.POSTERID}&amount=-1"><img src="{I_DOWN_1}" alt="[-1]" title="_(K_DOWN_1)" border="0" /></a> <!-- ENDIF --> <!-- ENDIF -->

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Ok once again I wasn't clever enough to figure out how to add the calculation of overall kudos to the forums, but seeing as Positive Kudos is a database field, it was easy enough to get that displayed in the forum.

Modules/Forums/viewtopic.php

around line 309 get the kudos_pos value by adding it into the query.

u.user_id, u.user_posts, u.user_from, u.user_website, u.kudos_pos,

around line 740 add

$poster_kudos = $postrow[$i]['kudos_pos'];

around line 1200 add

[code]'POSTER_KUDOS' => $poster_kudos, Then for display add to themes/yourtheme/templates/forums/viewtopic.html Positive Kudos:&nbsp;{postrow.POSTER_KUDOS}<br />[code]

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


ok got it to display overall Kudos, simply get the users kudos.neg as well and subtract it from the positive.

Pretty happy with it now.
Attachment: kudos.jpg
Description
Filesize 87.82 KiB
Viewed 6 Time(s)
You are not allowed to view/download this attachment

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Something that has never worked and is bugging me is that members cannot donate Kudos to other members.

We always get the "No Credit" error message when attempting to do so.

Thats generated by this class, maybe it needs updating somehow? Its basically like the credit check is failing.

private function credit_check() { global $db, $user_prefix; $check = $db->sql_fetchrow($db->sql_query("SELECT kudos_pos-kudos_neg AS kudos FROM ".$user_prefix."_users WHERE user_id=".$this->from_id)); if ($kudos < $check['kudos']) { cpg_error(_K_NO_CREDIT); } }

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Permissions thing I guess, discovered I can donate kudos fine if I login as Admin. Under my normal account it says i have no Kudos to donate, as in fails the credit check.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Try with:
Kinsman wrote
'C_ALTER1' => can_admin('Kudos') ? 1 : ($MAIN_CFG['kudos']['kudos_max'] > 0 ? 1 : ''), 'C_ALTER2' => can_admin('Kudos') ? 1 : ($MAIN_CFG['kudos']['kudos_max'] > 1 ? 1 : ''),

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


Lost me sorry, the idea is that users can donate their Kudos to other users, for that to happen it increases the other users Kudos, and removes that amount from the Donator.

Weirdly the credit check that's failing that I posted above doesn't even check user status, it just checks you have Kudos to give.

i suspect that it only works when I'm admin because its ignoring it.

The entire Kudos class is posted on the previous page if that helps.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


Did you check the donation options on the Kudos admin panel?

Also, if someone is interested, here is the Kudos 2.0 ZIP
Attachment: kudos_2.0.zip
Description Kudos 2.0 ZIP
Filename kudos_2.0.zip
Filesize 54.43 KiB
Downloaded 3 Time(s)
You are not allowed to view/download this attachment

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Hi mate, good to see you still about. Checking the Modules it says we have 2.0 installed, but I do not see any options surrounding Donations in Admin?

Though that would certainly make sense.

I still believe this credit check is failing, as its the only place in the entire code that I can find that generates the No Credit Error.

private function credit_check() { global $db, $user_prefix; $check = $db->sql_fetchrow($db->sql_query("SELECT kudos_pos-kudos_neg AS kudos FROM ".$user_prefix."_users WHERE user_id=".$this->from_id)); if ($kudos < $check['kudos']) { cpg_error(_K_NO_CREDIT); } }
Attachment: kudos.jpg
Description
Filesize 167.48 KiB
Viewed 4 Time(s)
You are not allowed to view/download this attachment

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


If you are going to install Kudos 2.0 there is not need to, but if you are not going to upgrade then you need to start using my bug fix as the ternary operators are wrong.

One more thing comes to my attention in:
if ($kudos < $check['kudos']) {}

Where $kudos is defined?

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


We have 2.0 installed, and I think you have nailed it nano, as its that precise check which fails, as in it does not think you have any credit to be donating Kudos.

I just have zero idea how to fix it. Sad

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


NanoCaiordo wrote
If you are going to install Kudos 2.0 there is not need to, but if you are not going to upgrade then you need to start using my bug fix as the ternary operators are wrong.

Where $kudos is defined?


That's right isn't defined, I think it should be $this->amount instead of $kudos. $this->amount to create the object.

Try this

if ($this->amount < $check['kudos']) {
			cpg_error(_K_NO_CREDIT);
		}

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


tested that, still the same error.

You cannot donate kudos that you do not have.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0

All times are UTC
Go to page Previous 1, 2, 3 Next


Jump to: