When I tried the above, I got this error message:
"The function visitor may not be called in a template. Only functions with whitelisted prefixes are allowed."
Want to add an HTML script tag with some variables in the script, to be on every page of the site, but only for logged in users.
I assume I need to add some conditionals in a template.
Exactly what template and exactly what is the code for the conditional?
Thanks!
I first require_once a file with this code to set up the XF2 environment:
$dir = __DIR__;
require($dir . '/src/XF.php');
XF::start($dir);
Then I use the finder as follows:
$finder = \XF::finder('XF:User');
$xfuser = $finder->where('username', $username)->fetchOne();
Then I get some data...
Thank you Katsulynx. Pardon this newbie question: What is the best way to look at one of the classes such as that one (/src/Entity/UserProfile.php)? Just opening the PHP file itself, or is there an API showing all of the XF 2 classes and functions?
I know I can get a user object like this:
$finder = \XF::finder('XF:User');
$user = $finder->where('username', "Joe")->fetchOne();
There is no age property or date of birth.
So I can get a profile object like this:
$profile = $user->Profile;
And that profile object has date of birth day...
Thank you very much katsulynx, that was a huge help. I had to play around with it a bit but I got it working.
Now a related question if I may.
What would the template syntax be to do the same thing -- but in a thread post? Basically I want to add a custom field like "country" near the...
Have my own PHP script to authenticate an XF2 user and trying to get the custom profile fields, like "country". That profile field is from a set of choices. Here is how far I've gotten:
// bootstrap framework
$dir = __DIR__;
require($dir . '/src/XF.php');
XF::start($dir);
$app =...
I"m password protecting our test site the simple way via .htaccess, even before the very long import process (importing millions of posts from VB4).
Will that cause any problem with the import? I assume not, just want to confirm, thanks!
We have many forums (but no subforums within forums) and I believe it's best for SEO purposes to have the particular forum name included in the thread URLs.
Is it possible to configure XF such that the URL of my threads includes the forum name as a directory? Like this:
mysite.com/[forum...
Doing some practice imports here, (importing from VB4+VBSEO), just have a simple question.
Have many XF addons to install... does it really matter if the addons are done before or after the import?
Thanks
Okay I guess we're getting warmer, will study this soon, thanks!
One question for future reference, should board be turned off while rebuilding the search index?