Random Member
Forum rules
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Random Member
Your Portal Version: 1.0.0RC3
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge
What have you done before the problem was there?
No Problem
What have you already tryed to solve the problem?
Description and Message
How does the random member thing work?
Is it possible to exclude members with zero posts or less than 5 posts? I would also like to use a custom profile field to allow users to include or exclude themselves from this. Would also be good to show the users profile and interests as well as their avatar.
I sit possible to do this?
Thank you
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge
What have you done before the problem was there?
No Problem
What have you already tryed to solve the problem?
Description and Message
How does the random member thing work?
Is it possible to exclude members with zero posts or less than 5 posts? I would also like to use a custom profile field to allow users to include or exclude themselves from this. Would also be good to show the users profile and interests as well as their avatar.
I sit possible to do this?
Thank you
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
To filter out users with < 5 posts, change the SQL in the file root/portal/block/random_member.php, Add a WHERE clausegirlintrouble wrote:<SNIP>
How does the random member thing work?
Is it possible to exclude members with zero posts or less than 5 posts? I would also like to use a custom profile field to allow users to include or exclude themselves from this. Would also be good to show the users profile and interests as well as their avatar.
I sit possible to do this?
Thank you
similar to : (for default)
Code: Select all
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
AND user_posts >= 5
ORDER BY RAND()';
user_rank
user_regdate
user_from
user_website
user_occ
What other profile info do you require?
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Re: Random Member
Thanks!
Well if I create a custom profile say with a boolean value Yes / No called showuser then can I add something to the sql which will not show users who have opted out ie showuser = no?
Additional fields:
Occupation
Location
Website
Is it possible? Thanks
Well if I create a custom profile say with a boolean value Yes / No called showuser then can I add something to the sql which will not show users who have opted out ie showuser = no?
Additional fields:
Occupation
Location
Website
Is it possible? Thanks
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
Yes, I will modify it for those fields and post the code.
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Re: Random Member
Thank you!!!!
What if I wanted to add any other custom profile field of extra information ion the futire to display will it be obvious how to add that too?
What if I wanted to add any other custom profile field of extra information ion the futire to display will it be obvious how to add that too?
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
I will add comments to show you how to modify it on your own.
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
Those columns are already being shown in the Random member block.girlintrouble wrote:Thanks!
Well if I create a custom profile say with a boolean value Yes / No called showuser then can I add something to the sql which will not show users who have opted out ie showuser = no?
Additional fields:
Occupation
Location
Website
Is it possible? Thanks
I am working on showing a checkbox in the User's Profile to "opt-out" of the Random Member block. Running into problems getting the values correctly from the DB otherwise it looks good.
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Re: Random Member
Thanks for the update, Im really excited (blush)
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
Still working on it, please be patient, I do this in my spare time.
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Re: Random Member
Thanks for the update.
I was thinking it would be better to exclude members who had not logged in for the last month. I guess that would be possbile through the sql too.
Hope thats ok
I was thinking it would be better to exclude members who had not logged in for the last month. I guess that would be possbile through the sql too.
Hope thats ok
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
Ok, here are the changes required to be able to allow the user to select if
they want to not be shown in the Random User Block and to also not show
them if they so choose... Sorry it took me so long but I had problems with
getting the options in the profile to work correctly.
God Luck.
Be sure to add the a column to your users table named
This code change limits the result set to include only the users that
want to be seen in the Block.
random_member.php:
In the section with your SQL, add this to the existing WHERE clause
(on the line before the ORDER BY:
And, if you want to limit to only users with > 5 posts, add this to the
WHERE clause:
I'll look into how to limit to only users that have logged in in the last month.
Now, to add the option for the user to select if they want to be seen
in the Random User block, make these changes:
language/<lang>/common.php
includes/ucp/ucp_main:
includes/ucp/ucp_profile:
styles/<style>/template/ucp_profile_profile_info.html:
they want to not be shown in the Random User Block and to also not show
them if they so choose... Sorry it took me so long but I had problems with
getting the options in the profile to work correctly.
God Luck.
Be sure to add the a column to your users table named
Code: Select all
user_showuser VARCHAR(3) NOT NULL default 'off'
want to be seen in the Block.
random_member.php:
In the section with your SQL, add this to the existing WHERE clause
(on the line before the ORDER BY:
Code: Select all
AND user_showuser = 'on'
WHERE clause:
Code: Select all
AND user_posts > 5
Now, to add the option for the user to select if they want to be seen
in the Random User block, make these changes:
language/<lang>/common.php
Code: Select all
$lang = array_merge($lang, array(
<!- SNIPPED CODE -->
'SETTINGS' => 'Settings',
'SHOWUSER' => 'Show In Random User Block',
<!- SNIPPED CODE -->
));
Code: Select all
$template->assign_vars(array(
'USER_COLOR' => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',
<!- SNIPPED CODE -->
'SHOWUSER' => ($user->data['user_showuser'] == 'on' ? 'checked="checked"' : '')
));
Code: Select all
$data = array(
'icq' => request_var('icq', $user->data['user_icq']),
<!- SNIPPED CODE -->
'showuser' => utf8_normalize_nfc(request_var('showuser', 'off')),
);
<!- SNIPPED CODE -->
if ($submit)
{
$validate_array = array(
'icq' => array(
array('string', true, 3, 15),
array('match', true, '#^[0-9]+$#i')),
<!- SNIPPED CODE -->
'showuser' => array('string', true, 2, 3),
); );
<!- SNIPPED CODE -->
'showuser' => utf8_normalize_nfc(request_var('showuser', 'off')),
<!- SNIPPED CODE -->
$sql_ary = array(
'user_icq' => $data['icq'],
<!- SNIPPED CODE -->
'user_showuser' => $data['showuser']
);
<!- SNIPPED CODE -->
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
<!- SNIPPED CODE -->
'SHOWUSER' => (($data['showuser'] =='on') ? 'checked="checked"' : ''),
));
Code: Select all
<tr>
<td class="row1" width="35%"><b class="genmed">{L_SHOWUSER}: </b></td>
<td class="row2"><input type="checkbox" class="radio" name="showuser" value="on" {SHOWUSER}/></td>
</tr>
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Re: Random Member
Wicked will try this very soon and let you know how I get on.
Thanks so much, I think this is a really good enhancement to the random member display.
Really happy.
Thanks so much, I think this is a really good enhancement to the random member display.
Really happy.
-
- Valued Contributor
- Posts: 64
- Joined: 25. June 2009 00:15
- phpBB.de User: MB34
Re: Random Member
So, did it work for you?
MrBaseball34
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
-
Topic author - Active Member
- Posts: 15
- Joined: 17. June 2009 12:15
- phpBB.com User: girlintrouble
- Location: UK
Re: Random Member
Had some other problems. Waiting to install the board 3 and then this great addition. Will certainly report back and tell you how great it is no fear!
Re: Random Member
I'd like to do the same.girlintrouble wrote:Thank you!!!!
What if I wanted to add any other custom profile field of extra information ion the futire to display will it be obvious how to add that too?
Can anybody help me? Please