e107help.org Q&A
0 like 0 dislike

Does anyone know how I can display shortcodes & user data on a page?

lets say I am using a custom page

 

<?php 
require_once("class2.php");
require_once(HEADERF);
$ns->tablerender("Welcome", "This is a Blank Template,");
echo ('') .SITENAME."\n";
require_once(FOOTERF);
exit;
?>

the above simply displays the sitename, but how can I display the users "username" and the extended field that I already created?

I have tried a few times with no success, I think I need an example as Im doing something wrong, if  someone could please help how I show the current users data plus shortcodes {user}, they seem even harder and fail me everytime it seems

thank you
Teesha

e107 version 2.18
in Core by (30 points) 4

1 Answer

0 like 0 dislike
by (1.9k points) 15 46 57
oh boy I been trying to get this for a week now... I can do alot with it but I cannot display a extended field no matter how hard I try, I get no return or a 500 server error.

All I really need is just to display an extended field that the users populated when they registered, I can do the username & email fine but not the extended fields

Im going crazy I even tried to clone another page just to find what im missing... can anyone show me a snip how I can display the extended field from the database named user_type,  not all of them  just the current user, if I can get one I can get the other im sure just getitng the first one is really making my head hurt.

PS:
it dont need to be a created page in cms, I can use a external custom page and include the template  if easier, Im thinking it might be that way since I can use php and code wont be filtered on any way...

please someone save me!!

Teesha
There are 2 types of extended fields.  For example birthday is core extended field. And there are custom extended fields.

If you need example how to use core extended field, you can see at birthday plugin on my site.

Sorry, I don't use custom extended field anywhere.   But if it works at user profile page (standard), you have something wrong.  If not, create issue on github.

print_a(USERID);

$qry = "
SELECT u.*, ue.* FROM #user AS u
LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id
WHERE u.user_id=".intval(USERID);
$sql->gen($qry);
$udata=$sql->fetch();

print_a($udata);
print_a($udata['user_type']); 

 

It was at that link I gave you in first answer. I tried it on contact page.

Result:

 

I did look at the link you gave me, and didnt quite understand it...

I am using a custom field... I should have noted that,

 

Waht I said was I tried to scalp the user_ page (template) since it did display the field fine, but wont show in my version without all the extra stuff...

I guess my understanding is that user data is floating around somewhere in a variable, just how to properly display the field, I can do name & email, and all the standard ones fine, this is only my first year in school so im struggling with a few things and teacher is busy with kids that are more lost, i study all the time but this is hard

anyways thanks, I try working with what you sent

 

thanks
Tasha
Maybe there is other way, but I don't know it.
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
935 questions
1,337 answers
2,346 comments
2,318 users