Support Forum
Hi SP team,
my first attempt to use a template tag seems to be not successful. I just tried to put
<?php sf_pm_tag(true, false); ?>
in one of my side templates and also the shortcode version
[sf_pm_tag]
but both won't work.
From the code version I get a fatal php error 'call to a undefined function in ...' and from the short code version I get nothing.
The plugin 'Template Tags' is installed and activated. Am I missing something?
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
Yes, it is! Works pefect for me.
Occassionally, you could let me know how this translation from function name to tag name works - or is there a reference list somewhere? Maybe, I have to wait for the official docs.
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
We are slowly compiling them and I did think that one was actually done but I was wrong.
The names of the functions in the actual template tag files themselves are not public names. The public names are contained in the main plugin file in each case. If it has a 'do' in the name then it s the wrong one basically!
YELLOW
SWORDFISH
|
Sorry to bother - but I still need some help with this. The tag works fine when used in a side template.
Now I am trying to invoke it triggered by a WP login filter like this
add_filter('wp_login', 'PN_check', 10, 3);
function PN_check($user, $username, $password){
?>
<div style="display:none" class="fancybox-hidden"><div id="popup" style="width: auto; padding: 5px">
<?php
global $wpdb;
// sf_pm_tag(TRUE, FALSE);
$pm = sf_pm_tag(FALSE, FALSE);
echo 'In Deinem Posteingang befinden sich '.$pm['count']. ' ungeöffnete Nachrichten';
?>
<a href="<?php echo $pm['url'] ?>">Zum Posteingang</a>
<!--<a href="#" onclick="javascript:jQuery.fancybox.close();return false;">Close this window</a>-->
</div>
</div>
<a id="fancybox-auto" class="fancybox" href="#popup"></a>
<?php
return $user;
}
in my theme's functions.php so that users should get a popup message when logging in.
But the returned string $pm is empty in this environment
Array
(
[count] => -1
[url] =>
)
How comes? Is the tag not valid here? Is it only valid in side templates?
But users can log in and out at any time when the site is up.
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
there os no such function as sf_pm_tag(). Were you not using sp_pm_inbox()?
Just for the record, WP filters are not intended to be used for displaying content directly like that. All content should be compiled up and then returned, in this case, in the $user variable. Except that would create chaos. 'Actions; should really be used for this sort of thing instead of 'Filters'.
YELLOW
SWORDFISH
|
Sorry, forgot to mention - this one is back to V4.5.1. And the sf_pm_tag-function returned a proper array in a side template. I'd like to try this first in my local (old) install rather than in the remote server which is already SP5.1.2.
You are right with filters and actions - this was just 'quick and dirty' to see wether it works.
What about validity? If I were using sp_pm_inbox in a WP login action hook, would it return proper array content?
"Computers in the future may weigh no more than 1.5 tons."
(Popular Mechanics, US-Technik-Magazin, 1949)
1 Guest(s)