'Pages' reserved for Admin

I want to reserve Pages for Admin at my site, so that lotsa contents could be brought by my team to the main page (Read access: public, write access: Admin only). It would look like a Joomla page -- A title, an intro and a "Read fully" link. The Pages widget would be accessible only from the Admin's dashboard. Is there a way out? 

Incidentally, External Pages could have served the purpose pretty well, if it were more transparent and accommodative. There is so much potential in that plugin. 

  • So basically you want to set your sites pages to porno-site-mode ;-)

    Just look at the pages plugin, verify the file where the permissions are and then copy that file into the relevent directory of your theme and modify it. If its in the correct place and you modify it correctly then it should be okay.

  • Can't it be stopped at the source -- I mean, before the 'Pages' widget is sent to the user's dashboard (under Edit Page) with a conditional class like "if not admin"?

     

  • Badly need Help

    I THINK THE SOLUTION IS HERE

        if (($owner instanceof ElggEntity) && (can_write_to_container(0,$owner->guid))){
            add_submenu_item(elgg_echo('pages:new'), $CONFIG->url . "pg/pages/new/?container_guid=" . page_owner(), 'pagesactions');

    How to convert the IF-part to read IF IT IS ADMIN.

    If it works out, I suppose, only the Admin can create Pages, while users can the the contents.

    So please please!

     

  • I'm not sure if this would be the fix, but for what you ask, I think the answer is:

    if(($user == admin))..

     

    From memory, a similar call to admin access is made in the elgg_topbar.php where the code tells the page to display the 'admin' link if the logged user is admin... I can't see a reason for why the same call cannot be used.

    Just a suggestion anyway.

    -Carlos 

  • I just checked that code in elgg_topbar:

    if ($vars['user']->admin || $vars['user']->siteadmin)

    Which tells me that what I suggested above can work.

    Hope this helps.

    -Carlos

  • @ Carlos

    if ($vars['user']->admin || $vars['user']->siteadmin) works, but, you are right, this is not where it is to be placed. I have to go further back.

    The code I quoted goes to tool>pages>PagesHome> and gives the New Page (create) option in the left bar menu. I need to put the IF before "New Page" is displayed (That is, after Tools>Pages, 'Pages Home' should not be displayed if the user is not the admin.

    By the way, I saw your response to my note elsewhere (Pages Vs Blogs). In connection with that, I want to tell you that what I am trying to do is to reserve write access to Pages for the admin. My purpose is to bring so much content to the site (possibly a Home Magazine, a near-CMS effect)).

    I agree with you that Pages are almost Like Blogs. But my line of thinking is that, when a Blog section is handy, why not use Pages for an entirely different purpose that would give a new face to the site. A single plugin called Buddypress magically turned Wordpress into a fully-fledged Social Network. I just see a similar CMS-oriented potential in Pages. I wish to create a Joomla-like main page for my site.

    Anyway, thanks for giving me something to work on. I really feel excited :)

  • @shillog..

    I think it is very possible to isolate the pages plugin for admin only.. The way I would approach this is very tricky.. Technically, my solution would leave the plugin active for all users, all it does, however, is give access to make a page entry to admin only.

    This can be achieved with the same approach as in the 'admin' link in the top bar. 

    Basically, we need to leave the pages plugin active. Then, we go to the pages view files and add an argument that only if user is admin display the link to 'create new page', else, do not give that link. What this achieves is an active pages plugin, where everyone is able to create a page, BUT ONLY ADMIN HAS THAT LINK TO CLICK AND CREATE THE NEW PAGE. Naturally, everyone will be able to read it.. One thing is left for us to do from there, modify the link in the topbar tools, from Pages, to, Admin Notes (or anything else you want). In the normal circumstances, this would take the user to a list of everyone's pages, but in this case since only admin will be creating the pages, the list will contain only admin pages.

    Obviously, you can import that view in your index page.. you can even take a description and display it under each page title.. The way we do this is by creating a < input type='text' value='{$pages->description}' /> (I'm not sure about the exact vars, but that's just an example). And, so that we do not have to import the entire page into that input area, we can tell it to have a maxlength of a certain number of characters.. I applied this to the messages plugin and it works perfectly.

    This is how I would approach this and it's just a suggestion.

    Please let me know if you need a hand.

    Cheers,

    -Carlos

  • @ carlos

    That sounds quite ok.

    Anything is ok as long as only the admin can CREATE a new page. Naturally I DO want the pages created be visible to all.  I certainly can do with you kind help, granted that you have enough free time at hand. My knowledge of Elgg coding is near-zero. And if what I propose can be accomplished and is made known, I am sure many Elgg-site owners will go for it.

    If only there were a master plugin to globally control permission for every plugin/widget. As I see it there are several methods to solve the problem. For instance, the default-widget option for dashboard and profile could be turned into a permitted-widget option. After all, the only widget that Profile really needs is the Message Board, and interestingly, for good reason, this is one widget that you can't access from the dashboard. I smell a clue here.

    Anyway, any help you can afford to offer without saddling you with it will be greatly appreciated, and it will make a difference in the long run. I am dreaming of an Elgg that could handle CMS as well.

    I settled for Elgg after trying out every major CMS/Blog/Network packages, because I see so many layers of possibilities not fully utilised in Elgg. In any other application of the kind, you can see evertything on the surface. Elgg has hidden depths. Its beauty is under the skin.

    Thanks and my warmest regards.

     

     

     

  • Hi,

    I have a similar problem, except that I want the blogs to be restricted to Admins.

    So, I copied the original blog plugin into a new one, and there I juste added admin_gatekeeper() to the index.php file of the plugin.

    That seems to work, and only admins can access blogs. Users will be forwarded to the homepage. However, I have not run yet a complete set of tests, therefore there may be flaws in this solution...

    Secondly, I would like to hide the "Blogs" link in the topbar menu.

    I added a test in /views/default/navigation/topbar_tools.php to show only the link to admins.

    foreach($alphamenu as $item) {
                    if ($item->name == "Blogs" && isadminloggedin() ) {
                   
                    } else {
                        echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>";
                    }
                }

    and that works fine as well.

    However, I coded this in the Elgg core, and I would prefer to put this in my plugin. So I copied this file into /mod/myplugin/views/default/navigation/topbar_tools.php, but that does not work. How can I override the default file, without changing it ?

    Could someone help me with this please ?

    Cheers,

  • Hi Supra..

    A few things,

    First.. adding the 'admin gatekeepr' to the index page will prevent other users from accessing the entire blog mod. Is this what you are trying to achieve..? Or, are you calling blog entries to be accessed by users some where else?

     

    Secondly, the code works, and that is the correct way of tackling the problem for dealing with the tools menu, although, if ($vars['user']->admin || $vars['user']->siteadmin) {, could have been used.

     

    Thirdly, in your plugin, did you list your file in the extend_view (in start.php)?

     

    -Carlos