IF Syntax

Discussion forum for MOD Writers regarding MOD Development.
User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

IF Syntax

Post by Fire-Fox » Tue May 24, 2011 2:27 pm

How can i do a if statement, so it's only the user that can se the content between the <!-- IF --> something here <!--ENDIF--> and when i users browsers his profil. He can't se that content?
Regards
Fire-Fox
Denmark

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51883
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: IF Syntax

Post by Brf » Tue May 24, 2011 2:33 pm

What are you trying to accomplish?

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Tue May 24, 2011 2:43 pm

I'll tell you :D

I have a bot on my irc channel.

and the bot have a invite script, and when a user types

Code: Select all

/msg BOTNAME <username> <user_password>
the site SELECT the user_password from the phpbb_users table and puts in the memberlist_view.html but it currently displays it to all and i want it only to be displayed to the user who owns the user_password....

hope you understand...
Regards
Fire-Fox
Denmark

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51883
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: IF Syntax

Post by Brf » Tue May 24, 2011 2:48 pm

I am not following you at all.

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Tue May 24, 2011 2:51 pm

lets say you join my site. under your profile: http://www.phpbb.com/community/memberli ... e&u=184120

you can se a passkey, then will allow you access to channel i choose you should see and use.

but i need somekind og if statement, so users who don't own the passkey can't see it in http://www.phpbb.com/community/memberli ... e&u=184120

if i browse another users profil i can see his passkey. he only should be able to see it :)

hope that helped?
Regards
Fire-Fox
Denmark

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51883
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: IF Syntax

Post by Brf » Tue May 24, 2011 2:55 pm

No I am still not following.
phpBB does not have "passkeys".
If it did, what would be the purpose of showing it on memberlist_view, since that is the page designed to show other users your profile? It would make more sense to send it in a PM.

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Tue May 24, 2011 3:00 pm

i choosed to call it "passkey" i know phpbb dosn't have passkey :)
Regards
Fire-Fox
Denmark

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: IF Syntax

Post by tbackoff » Tue May 24, 2011 5:59 pm

I think I follow what your saying. What is your template variable named?

Code: Select all

<!-- IF YOUR_VARIABLE -->{YOUR_VARIABLE}<!-- ENDIF -->
That should work.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Tue May 24, 2011 7:11 pm

t_backoff wrote:I think I follow what your saying. What is your template variable named?

Code: Select all

<!-- IF YOUR_VARIABLE -->{YOUR_VARIABLE}<!-- ENDIF -->
That should work.
Correct me if im wrong i did

in memberlist_view.html i added

Code: Select all

<dt>{L_USER_PASSWORD}:</dt> <dd>{USER_PASSWORD}</dd>
in memberlist.php i added.

Code: Select all

	   $sql = 'SELECT user_password
                  FROM'.USERS_TABLE.' 		
		WHERE user_id='.$user_id;
		$result = $db->sql_query($sql);
			$template->assign_vars(array(
			
			'USER_PASSWORD'			=> $member['user_password'],
			));
Regards
Fire-Fox
Denmark

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: IF Syntax

Post by tbackoff » Wed May 25, 2011 12:21 am

Fire-Fox wrote:

Code: Select all

<dt>{L_USER_PASSWORD}:</dt> <dd>{USER_PASSWORD}</dd>
I would change USER_PASSWORD to something different (IRC_PASSWORD or whatever) just to be on the safe side (of not conflicting with phpBB).
Fire-Fox wrote:

Code: Select all

	   $sql = 'SELECT user_password
                  FROM'.USERS_TABLE.' 		
		WHERE user_id='.$user_id;
		$result = $db->sql_query($sql);
			$template->assign_vars(array(
			
			'USER_PASSWORD'			=> $member['user_password'],
			));
There's a couple things wrong with this. First, where are you setting $user_id, and if it is being set, it could be any number (instead of the person's actual profile). $user->data['user_id'] is what you want. Second, as I mentioned above, you will want to rename your db field to something else. I think phpBB actually has a user_password field already. Lastly, $member is defined already, but I don't see you appending that data to it. In the end, you will have something like this:

Code: Select all

$sql = 'SELECT irc_password
    FROM' . USERS_TABLE . '
    WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
    $template->assign_vars(array(
        'IRC_PASSWORD' => $row['irc_password'],
    ));
}
$db->sql_freeresult($result);

Code: Select all

<!-- IF IRC_PASSWORD --><dt>{L_IRC_PASSWORD}:</dt> <dd>{IRC_PASSWORD}</dd><!-- ENDIF -->
You will need to add IRC_PASSWORD to the memberlist.php language file.
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Thu May 26, 2011 10:26 am

t_backoff wrote:
Fire-Fox wrote:

Code: Select all

<dt>{L_USER_PASSWORD}:</dt> <dd>{USER_PASSWORD}</dd>
I would change USER_PASSWORD to something different (IRC_PASSWORD or whatever) just to be on the safe side (of not conflicting with phpBB).
Fire-Fox wrote:

Code: Select all

	   $sql = 'SELECT user_password
                  FROM'.USERS_TABLE.' 		
		WHERE user_id='.$user_id;
		$result = $db->sql_query($sql);
			$template->assign_vars(array(
			
			'USER_PASSWORD'			=> $member['user_password'],
			));
There's a couple things wrong with this. First, where are you setting $user_id, and if it is being set, it could be any number (instead of the person's actual profile). $user->data['user_id'] is what you want. Second, as I mentioned above, you will want to rename your db field to something else. I think phpBB actually has a user_password field already. Lastly, $member is defined already, but I don't see you appending that data to it. In the end, you will have something like this:

Code: Select all

$sql = 'SELECT irc_password
    FROM' . USERS_TABLE . '
    WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
    $template->assign_vars(array(
        'IRC_PASSWORD' => $row['irc_password'],
    ));
}
$db->sql_freeresult($result);

Code: Select all

<!-- IF IRC_PASSWORD --><dt>{L_IRC_PASSWORD}:</dt> <dd>{IRC_PASSWORD}</dd><!-- ENDIF -->
You will need to add IRC_PASSWORD to the memberlist.php language file.

Thank for the reply, but don't have "irc_password" in the database, only user_password as allready exist in the database....
Regards
Fire-Fox
Denmark

User avatar
tbackoff
Former Team Member
Posts: 7022
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: IF Syntax

Post by tbackoff » Thu May 26, 2011 11:26 am

t_backoff wrote:I would change USER_PASSWORD to something different (IRC_PASSWORD or whatever) just to be on the safe side (of not conflicting with phpBB).
Flying is the second best thrill to cheerleaders; being caught is the first.

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Thu May 26, 2011 2:23 pm

I cant't just change it, bacause the it will error when users signup on the site correct?
Regards
Fire-Fox
Denmark

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51883
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: IF Syntax

Post by Brf » Thu May 26, 2011 2:40 pm

user_password is the hash of that user's password to phpBB.

You are saying you want to put that password hash on the user's own profile page if the bot in IRC has been activated.

What purpose would this accomplish? The user, if he is logged in, already knows his password to phpBB, and displaying the hash to him will serve no purpose.

User avatar
Fire-Fox
Registered User
Posts: 68
Joined: Tue Jun 16, 2009 1:13 pm
Contact:

Re: IF Syntax

Post by Fire-Fox » Thu May 26, 2011 3:00 pm

Brf wrote:user_password is the hash of that user's password to phpBB.

You are saying you want to put that password hash on the user's own profile page if the bot in IRC has been activated.

What purpose would this accomplish? The user, if he is logged in, already knows his password to phpBB, and displaying the hash to him will serve no purpose.
The purpose is that the bot is in some channels where normalt users can't come in. and the invite it rank based so in order to get in they need to

Code: Select all

/msg BOTNAME Fire-Fox <the hash here>
then the bot does a search in the phpbb_users table on the users with that rank, and if the rank match the settings in the bot script he will get in ...
Regards
Fire-Fox
Denmark

Locked

Return to “[3.0.x] MOD Writers Discussion”