Khaled Afiouni's plugins:
4
Recommendations
Display a login form on external sites or other directories or subdirectories
Displays an elgg login box only without other page elements. Useful for displaying a login form in a subfolder or on a page in an external site or even a local file :)
Upon logout, this plugin will also redirect the user to the page where the user originally did login.
To use this plugin, simply add the following anywhere in a page to display the login box at this location:
<script src="http://example.com/pg/remotelogin/load.js" type="text/javascript"></script>
If you would like to add scripts to your html header or would like to style the box differently, following are the different scripts and styles that this plugin loads for the login box to work properly. Therefore, you can replace the stylesheet with your own or remove the jQuery loading if it is already loaded in your page.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" ></script>
<script src="http://example.com/pg/remotelogin/remoteajax.js" type="text/javascript" ></script>
<link rel="stylesheet" href="http://example.com/pg/remotelogin/style.css" type="text/css" />
<div id="remotelogin"></div>
<script src="http://example.com/pg/remotelogin/run.js" type="text/javascript" ></script>
Upload, extract, enable... Enjoy!
i guess this function much worth if you can create simple javascript shoutbox so people can keep in touch anywhere if they registered in elgg site
Alfirus 762 days ago
@Alfirus
This plugin does not expose the username or password of the user anywhere. So unfortunately, it cannot be used for integration other than displaying a login form outside the elgg directory.
As for the shoutbox, I appreciate if you can send me more details about the idea here
Khaled Afiouni 762 days ago
Good stuff, Thanks.
Free Articles 762 days ago
How do I have to change this to show the latest members using the mod/members plugin?
Matthias 760 days ago
Thanks for the plugin
Can you let me know how to show the latest river activity in external page
thanks in advance
Wansuk 759 days ago
Apologies for being late in replying... I have been experimenting options and while I have not been able to reach a solid solution to displaying different portions, views, or widgets remotely, I thought to share my findings and probably wait for elgg geeks to help with it :)
First off, this current plugin can be edited to show any portion of any page of elgg by changing the
pg/remotelogin #login-box
Of course the first part is the page URL and the second is the "id" of the element you want clipped and included in your page.
I tested some pages and elements and did not like the results. Furthermore, it is a very heavy load... This will prepare the whole page, download it locally using remote ajax (including YQL calls), parsethe page locally, and clip the portion of the page required. Personally speaking, I do not want this to happen on every page of my remote site :)
In order to overcome this, I was thinking of creating a "Remote View" plugin. This plugin will render a single view and return it with minimal header and meta data. This plugin can be used to embed the returned HTML in a <iframe> element therefore minimizing the need for javascript and parsing and the rest...
What I was testing is a plugin that accepts view names in the URL itself like this:
http:/
/ example.com/ pg/ remoteview/ riverdashboard/ newestmembers/ normal.html
In this example, the "riverdashboard/newestmembers" part is the view name (in this case a view to display the recent members), and "normal.html" is where we pass parameters to the plugin including, for example, options like "nocss" to omit the css from the output.
The code I tested goes like this:
register_page_handler('remoteview', 'remoteview_page_handler');
function remoteview_page_handler ($page)
{
global $CONFIG;
if (!is_array($page) || count($page) == 0 || $page[0] == '' || is_null($page[0]) || !isset($page[0])):
header("Content-type: text/html; charset=UTF-8");
echo "Wrong call format. Please check the plugin usage!";
return false;
endif;
$rv_params = $page;
$rv_options = strtolower(array_pop ($rv_params));
$rv_no_css = (strrpos($rv_options, "nocss")!== false);
$rv_html_call = (strrpos($rv_options, ".html")!== false);
$rv_js_call = (strrpos($rv_options, ".js")!== false); //TODO: Support js with document.write instead of iframe
$rv_view_name = implode ('/', $rv_params);
header("Content-type: text/html; charset=UTF-8");
echo '<html>';
echo '<head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo '<title>' . $CONFIG->sitename . ' : Remote View Plugin : ' . $rv_view_name . '</title>';
if (!$rv_no_css):
echo '<link rel="stylesheet" href="' . $CONFIG->url . '_css/css.css?lastcache=' . $CONFIG->lastcache . '&viewtype=default" type="text/css" />';
endif;
echo '</head>';
echo '<body>';
echo elgg_view($rv_view_name);
echo '</body>';
echo '</html>';
}
Khaled Afiouni 757 days ago
Thanks a lot for the plugin, this is exaclty what I need!
Unfortunately, the plugin does not work on my setup. When I enter the login data on the external page, I am transferred to the elgg site, but receive an error ("Token mismatch").
From my web server logs:
WARNING: Action file/icon was called without an action token. It is stongly recommended that you consider doing this. Plugin authors should use 'input/form' or pass is_action=true to 'output/confirmlink' or 'output/url'., referer: http:/
I am using Elgg 1.6.1. Thanks for any help!
Alex F. 756 days ago
I have been looking for something like this. I was able to put the login box on different pages on my site and it worked, but did not work on one of my other sites. The box worked but when you enter the info and try to log on it says: Fatal error: Call to a member function getGUID() on a non-object in /home/content/z/0/9/z09jmm/html/dfsn/engine/lib/entities.php on line 2078. Any suggestions? I am new to all of this and am trying to learn it, but I am way behind. Thanks 1.61
Bigyack 756 days ago
I also get: Fatal error: Call to a member function getGUID() on a non-object in /home/content/z/0/9/z09jmm/html/dfsn/engine/lib/entities.php on line 2078
Bigyack 756 days ago
@Alex, @Bigyack
Would you please open the page example.com/pg/remotelogin and try to login from there directly and let me know about the result.
Khaled Afiouni 756 days ago
I opened mysite.com/pg/remotelogin and after I logged in it gave me a token mismatch error, but did not give me the fatal error from before.
Bigyack 756 days ago
@BigYack,
When is the last time you actually hired $paid or pretented to to pay for -- fix your elgg/ php problems ?
DhrupDeScoop 756 days ago
@Khaled, thanks for you reply. Logging in through mysite.com/pg/remotelogin actually works fine.
Also, I now assume that the web server error I cited above is NOT related to this issue.
Any ideas why the login does not work from the remote site?
Alex F. 756 days ago
@Khaled, if you can help me to fix the issue with the plugin so that it will work on my Elgg installation, I will gladly donate 20 EUR. I know it's noch that much, but that's what I can offer.
Please write to
emergenz //at// gmail //dot// com
Alex F. 755 days ago
@Alex.. that's a nice gesture from you ;-) quite not so often people here do that ;-O -- Regards.
DhrupDeScoop 755 days ago
@Alex... A free cup of coffee ;) will email you to get the details
Khaled Afiouni 755 days ago
@KA--> Now that's a good developer LOLZ ;-P`` I think I'll send you my long list of nice-to-have features for PlugIns ;-) All the coffee (the finest Arabica beans) that you want heh heh.. BTW I am "jealous" that you coded this plugin ;-O My earlier custom solution let the user create their own external homepage with one small trick - they defined a special tag (::LOGIN::) within their htnl, which then gets read in by the real index.php for the external site, picks out the ::LOGIN:: abd replaces that by all the Elgg stuff, adding the external site's styling on the fly. What you've done makes it easier for the average user to implement external logins. ps: have you looked at using sessions vars to "expose the logged-in user details ? I wonder if that could make it work ? (haven't actually tries to test this myself b/c 16 hours per day x 7 days = code, code, code...)
DhrupDeScoop 755 days ago
@Alfirus
In order to get the user name of the user, you can use the following hack
http:/
Khaled Afiouni 754 days ago
Thank you very much for this plugin, that is exacely what I was looking for!
francescomda 737 days ago
@Khaled
Sorry for late reply. I'm bz with clients' web. Now I have times to test it out with my partner's web base game. Will keep in touch with you once tested.
Alfirus 726 days ago
Hi !
Thanks for your plugin, it is very usefull.
But I have still a problem :
When I create users after installed remote plugin, and when I connect these users I'm not able to disconnect them.
I'm working on 1.6.1 version.
Do you have any idea ?
Regards,
Benoit
Benoit 715 days ago
Hello
I found a solution. You had registered the action "logout.php" with the parameter admin_only to 'true' so only the admin could logout. I set this parameter to 'false' and that work, for the moment ^^
Have a nice day
Benoit
Benoit 715 days ago

Alfirus
Profile
Friends
Friends of
Plugins
is username variable posted to the external site? if yes, this can be usefull for me to create customize application intergrated with elgg!
Alfirus 762 days ago