Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2096

phpBB Custom Coding • Re: MEMBERLIST_BODY.HTML customisation

$
0
0
Thanks all for your considered responses...
Did you purge the cache? Anytime you make edit to template you need to purge the cache.
I purge the cache if I change the .HTML but it's mostly been edits to the .PHP file trying to get it to produce an output, but thanks for the tip about disabling that during development.
Can you share your code you've added so far and to what locations? It could be that the data is not being loaded correctly as a template variable and as such is not appearing because it's not being passed to the template. Having said that, without seeing your code it's impossible to know why it's not working for you.
I tend to go back to the default file after a fruitless session of trying to get it to work so I don't have modified files. The code I've used in my custom page for testing is:

MEMBERLIST_BODY.HTML
after

Code:

<td><span class="rank-img"><!-- EVENT memberlist_body_rank_prepend --><!-- IF memberrow.RANK_IMG -->{memberrow.RANK_IMG}<!-- ELSE -->{memberrow.RANK_TITLE}<!-- ENDIF --><!-- EVENT memberlist_body_rank_append --></span><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- IF memberrow.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_body_username_append --><!-- IF S_IN_SEARCH_POPUP --><br />[&nbsp;<a href="#" >{L_SELECT}</a>&nbsp;]<!-- ENDIF --></td>
insert

Code:

    <td><!-- IF USER_DESIGNATION  -->{USER_DESIGNATION}<!-- ELSE -->ID<!-- ENDIF --></td>    <td><!-- IF USER_FIRSTNAME -->{USER_FIRSTNAME} {USER_SURNAME}<!-- ELSE -->Full Name<!-- ENDIF --></td>
MEMBERLIST.PHP
insert

Code:

// Start session management$user->session_begin();$auth->acl($user->data);$user->setup();$user_id = $user->data['user_id'];
and

Code:

$sql = 'SELECT memberid, user_firstname, user_lastname FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; $result = $db->sql_query($sql);$user_data = $db->sql_fetchrow($result);$template->assign_vars(array(    'MEMBER_ID' => $user_data['memberid'],    'USER_FIRSTNAME' => $user_data['user_firstname'],    'USER_LASTNAME' => $user_data['user_lastname'],));
Where to insert this is the basis of my question. My guess that it was somewhere between

Code:

default:// The basic memberlist
and

Code:

else if ($first_char){$sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->get_any_char());}
I'm puzzled as to why you think/fear CPF may not be acceptable as a solution.

CPF is a default feature, has options to choose from as to field type/size/display options, even language options.
What more do you need?
"may not be acceptable as a solution... in my own head". I didn't say it was a rational fear!
Since I already have the data in PHP_USERS where users can't make alterations it seems redundant to duplicate it in PHPBB_PROFILE_FIELDS_DATA where it'll always be editable to my knowledge. I'm a simple man blundering my way through this and I like the idea having my user data in a single user table I guess..?

As mentioned I know I can use CPF and if there's really no other answer I will and use <!-- IF 0 --> to hide the <!-- BEGIN custom_fields --> block of CPF data from the table rather than duplicate it, but I won't like it. ;)

Statistics: Posted by mmccreadie — Tue May 21, 2024 5:22 pm



Viewing all articles
Browse latest Browse all 2096

Trending Articles