MyBB Community Forums

Full Version: How to write this?!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
EDIT

{$post['username']} Koin: 
<if $thread['uid'] == $post['uid'] then>
<a href="{$mybb->settings['bburl']}/newpoints.php?action=donate&amp;uid={$post['uid']}" title="You want to donate coins to {$post['username']}? ">{$post['newpoints']}</a>
<else />
<a href="{$mybb->settings['bburl']}/newpoints.php" title="You can't donate coins to your self">{$post['newpoints']}</a>
</if>
Turns out the problem hasn't ended here. if the thread belongs to another member, the code can run normally. but if the thread belongs to me, then the code does not run normally. Dodgy

and I also want to display an article where if a guest sees the donation feature, the guest is required to log in first  Confused

<br />
{$post['username']} Koin: 
<if (in_array($mybb->user['usergroup'], array(1,5,7))) then>
 <a href="{$mybb->asset_url}/member.php?action=login" title="You Need to Login">{$post['newpoints']}</a>
<elseif $thread['uid'] == $post['uid'] then>
 <a href="{$mybb->asset_url}/newpoints.php?action=donate&amp;uid={$post['uid']}" title="You want to donate coins to {$post['username']}? ">{$post['newpoints']}</a>
<else>
 <a href="{$mybb->asset_url}/newpoints.php" title="You can't donate coins to your self">{$post['newpoints']}</a>
</if>
<br />

is there something wrong with my code?
please correct
Yes you need to compare post id with user id.

Like:

If $post['uid'] == $mybb->user['uid']

And that would solve the issue.

And remember to use for guest if !$mybb->user['uid']

Besides usergroups due you have added banned and to confirm account.
@Whiteneo
thanks dude, but not work  Blush

My thread My Post
[attachment=45203]

Quote:conditions will run permanently in all forums / subforums as they function if in a thread :
  1. My Post: so I can't donate to myself
  2. Other Post Member: then I can make a donation to that member
  3. Me as a Visitor/Guest/Awaiting Acvited/Banned: then I can't make a donation. url points to login or register.

I made repeated coding changes to achieve what I wanted. although I'm not proficient in php coding. please help correction
<br />
{$post['username']} Koin: 
<If $post['uid'] == $mybb->user['uid'] && in_array($mybb->usergroup['gid'], array('2', '3', '4', '6', '8', '9', '10')) then>
 <a href="{$mybb->asset_url}/newpoints.php?action=donate&amp;uid={$post['uid']}" title="You want to donate coins to {$post['username']}? ">{$post['newpoints']}</a>
</if>
<if in_array($mybb->usergroup['gid'], array('2', '3', '4', '6', '8', '9', '10')) then>
 <a href="{$mybb->asset_url}/newpoints.php" title="You can't donate coins to your self">{$post['newpoints']}</a>
</if> 
<if !$mybb->user['uid'] then>
 <a href="{$mybb->asset_url}/member.php?action=login" title="You Need to Login">{$post['newpoints']}</a>
</if>
<br />

***EDIT***
after a few tries
<br />
{$post['username']} Koin: 
<if (in_array($mybb->user['usergroup'], array(1,5,7))) then>
 <a href="{$mybb->asset_url}/member.php?action=login" title="You must Login first to be able to donate to {$post['username']}. Register yourself if you haven't joined this community yet">{$post['newpoints']}</a>
<elseif $post['uid'] == $mybb->user['uid'] then>
 <a href="{$mybb->asset_url}/newpoints.php" title="You can't donate coins to your self">{$post['newpoints']}</a>
<else>
 <a href="{$mybb->asset_url}/newpoints.php?action=donate&amp;uid={$post['uid']}" title="You want to donate coins to {$post['username']}? ">{$post['newpoints']}</a>
</if>
<br />

it's worked like what i want  Big Grin
SOLVED!  Big Grin
Pages: 1 2