PDA

View Full Version : How to secure a cms widget


HeLLCiTo
01-11-2012, 08:05 AM
I have an html widget :



<head>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache, mustrevalidate">
<meta http-equiv="Last-Modified" content="0">
<meta http-equiv="Pragma" content="no-cache">
</head>
<iframe src="http://www.spanishred.com/noticias/series.html" name="aframe" width=350 height=2320 frameborder="no" align="center"></iframe>


and i want tha this widget only can see one group of users, i supose i hace to use a php widget.How can i do? i searched in the forum, but a did?t find anything.

thanks

kh99
01-11-2012, 02:13 PM
If you just want the widget to have no content (or maybe a different message for other usergroups), you could make it a php widget and for the code do something like:

if (is_member_of(vB::$vbulletin->userinfo, X)
{
$output = 'only seen by group X';
}
else
{
$output = 'only seen by other groups';
}



If you want the widget to completely disappear, you could copy the vbcms_widget_execphp_page template code to a new template, add:
<vb:if condition="is_member_of($bbuserinfo, X)">
//code from vbcms_widget_execphp_page
<vb:if>


Then configure your PHP widget and add your new template in the Template Name field, and make the code
$output = 'html for my widget';

In either case you need to set the Cache Refresh Time for the widget to 0.