adding informations in memberlist viewpage

Discussion forum for Extension Writers regarding Extension Development.
User avatar
sebo
Registered User
Posts: 36
Joined: Mon Jan 22, 2024 10:28 pm

adding informations in memberlist viewpage

Post by sebo »

hi!
i'm trying to view more informations in the memberlist.php viewprofile case.

i edited the core.memberlist_view_profile and core.memberlist_modify_view_profile_template_vars and assigned to the $template_ary 2 more values:

so now in the array $template_ary, making a var_dump() i have something like:

Code: Select all

["S_CUSTOM_FIELDS"]=> bool(false) ["U_USER_ADMIN"]=> string(90) "./adm/index.php?i=users&mode=overview&u=2&sid=bee7fa15b9ab64a12b9315f9297cbda1" ["U_USER_BAN"]=> string(0) "" ["U_MCP_QUEUE"]=> string(58) "./mcp.php?i=queue&sid=bee7fa15b9ab64a12b9315f9297cbda1" ["U_SWITCH_PERMISSIONS"]=> string(0) "" ["U_EDIT_SELF"]=> string(45) "./ucp.php?i=ucp_profile&mode=profile_info" ["S_USER_NOTES"]=> bool(true) ["S_WARN_USER"]=> bool(true) ["S_ZEBRA"]=> bool(false) ["U_ADD_FRIEND"]=> string(30) "./ucp.php?i=zebra&add=test" ["U_ADD_FOE"]=> string(44) "./ucp.php?i=zebra&mode=foes&add=test" ["U_REMOVE_FRIEND"]=> string(0) "" ["U_REMOVE_FOE"]=> string(0) "" ["U_CANONICAL"]=> string(68) "http://localhost/test/phpBB3/memberlist.php?mode=viewprofile&u=2" ["USER_DONATORE_CHE"]=> string(1) "1" ["USER_LOGO_DONATORE"]=> string(1) "0"
i moved to the template, and added a new html page in event: memberlist_view_non_contact_custom_fields_before
if i write:
{U_CANONICAL} it appears http://localhost/test/phpBB3/memberlist.php?mode=viewprofile&u=2
if i write
{USER_DONATORE_CHE} it doesn't appears nothing...i expected to appear 1 but it doesn't...why :| :cry:
User avatar
sebo
Registered User
Posts: 36
Joined: Mon Jan 22, 2024 10:28 pm

Re: adding informations in memberlist viewpage

Post by sebo »

i've got the same issue on another code page...

if I make make a var_dump of the array in $post_row in viewtopic.php I can see the variables i have added...

Code: Select all

$post_row = array_merge($post_row, array(
		
				'IMMAGINI_POST_AUTHOR' => !empty($quante_imm_galleria) ? $quante_imm_galleria : null,
				'GUIDE_POST_AUTHOR' => !empty($quante_gui_galleria) ? $quante_gui_galleria : null,
			
			));
but in the template HTML if I write {postrow.IMMAGINI_POST_AUTHOR} it doesn't appear...why? what am i doing wrong? :?: :?:
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3803
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay

Re: adding informations in memberlist viewpage

Post by Kailey »

I don't see this mentioned in your posts, so apologies if you've already tried this; have you purged the cache? Any time edits are made to the template files, the cache must be purged. You may also need to refresh your browser cache (generally CTRL + F5).
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules
If you have any questions about the rules/customs of this website, feel free to send me a PM.

My little corner of the world | Administrator @ phpBB Modders
User avatar
sebo
Registered User
Posts: 36
Joined: Mon Jan 22, 2024 10:28 pm

Re: adding informations in memberlist viewpage

Post by sebo »

yes made it, thnks for answering but i've still not solved it :cry:
User avatar
sebo
Registered User
Posts: 36
Joined: Mon Jan 22, 2024 10:28 pm

Re: adding informations in memberlist viewpage

Post by sebo »

ok...solved it, but it's really diffucult to understand for me...

in phpbb is different between:

Code: Select all

$poster_id = $event['poster_id'];
$user_cache = $event['user_cache'];
$post_row = $event['post_row'];
		
$event['post_row'] = array_merge($event['post_row'], array(
this works...

Code: Select all

$poster_id = $event['poster_id'];
$user_cache = $event['user_cache'];
$post_row = $event['post_row'];
		
$post_row = array_merge($post_row, array(
this one doesn't.... :?:
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3803
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay

Re: adding informations in memberlist viewpage

Post by Kailey »

What about utilizing the $event->update_subarray() function?

Code: Select all

$data = [
	'IMMAGINI_POST_AUTHOR'	=> $quante_imm_galleria ?? null,
	'GUIDE_POST_AUTHOR'		=> $quante_gui_galleria ?? null,
];

foreach ($data as $key => $value)
{
	$event->update_subarray('post_row', $key, $value);
}
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules
If you have any questions about the rules/customs of this website, feel free to send me a PM.

My little corner of the world | Administrator @ phpBB Modders
rxu
Extensions Development Team
Posts: 3804
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation

Re: adding informations in memberlist viewpage

Post by rxu »

https://area51.phpbb.com/docs/dev/3.3.x ... t-listener
The note at the end of the paragraph explains it.
User avatar
sebo
Registered User
Posts: 36
Joined: Mon Jan 22, 2024 10:28 pm

Re: adding informations in memberlist viewpage

Post by sebo »

Kailey wrote: Thu Feb 29, 2024 4:54 pm What about utilizing the $event->update_subarray() function?

Code: Select all

$data = [
	'IMMAGINI_POST_AUTHOR'	=> $quante_imm_galleria ?? null,
	'GUIDE_POST_AUTHOR'		=> $quante_gui_galleria ?? null,
];

foreach ($data as $key => $value)
{
	$event->update_subarray('post_row', $key, $value);
}
did it, thanks!
rxu wrote: Thu Feb 29, 2024 5:01 pm https://area51.phpbb.com/docs/dev/3.3.x ... t-listener
The note at the end of the paragraph explains it.
for this too!! got it! ;)

Return to “Extension Writers Discussion”