I am building another plugin to add Disqus Commenting system to Zenphoto.
I have the plugin working but whenever I call it I get the php "undefined function" error.
The plugin is setup like:
class disqus_comment_form {
//options function
function printDisqusCommentForm {
//print stuff
}
}
I have tested that the class exists on the page with:
if (class_exists('disqus_comment_form')){//test}
But it still can't find the function unless I use:
$disqus = new disqus_comment_form();
$disqus->printDisqusCommentForm();
All of the other example plugins I have been looking through don't have to do this but I can't figure out what I have done differently.
I've probably missed something very simple but any help would be greatly appreciated.
Comments
$disqus = new disqus_comment_form();
$disqus->printDisqusCommentForm();
`
Yes, as you cannot use a class method directly. This is how object orientation works and how you setup it. However you class is missing a constructor. Otherwise you can make the method static if it is standalone having no other depencencies to call it without creating an object first.
Our official comment_form plugin is based on a class as well but it also additionally has the plain function `printCommentForm()` that directly can be used on themes.
It may naturally not work anymore since it isn't maintained but maybe it does or could be a starting point for you.
With my Disqus plugin I am hoping to use Single Sign On (SSO) so the user wont have to register for my site twice (once to use favorites etc. and the other to use Disqus comments).
To do this I need to be able to get the current user's id, name and email and use it on any page that Disqus is active. What would be the best way to get this information?
(http://www.zenphoto.org/news/zenphotos-global-variables)
`
$_zp_current_admin_obj->getUser() // Login name
$_zp_current_admin_obj->getID() // User ID (number)
$_zp_current_admin_obj->getEmail() // Email
`
There is a federated logon plugin available for similar things. Never used it myself and we don't really maintain it although it is included I admit.