Adding fields in the Page

We will discuss how to add fields in a page. There are also some users that would like to create pages just with the admin and owner of a group, this will be something to talk about too.

(This topic has been created to continue the discussion created in a wrong group http://community.elgg.org/mod/groups/topicposts.php?topic=494462&group_guid=75603)

  • Hello,
    I hope this can help, in my last instruction I missed the line where I was instancing the object. I think if you follow this lines you will get it. (Do you think it would help if I post the plugin?)
    If there is an error just let me know as I didn't have the time to test much than 10 minutes.

    Regards.

    Instructions.
    1 - Fields

    To make the fields appear in the form

    You should go to the file /elgg1.7.1/mod/pages/start.php
    On line 75 you will see this array
            $CONFIG->pages = array(
                'title' => 'text',
                'description' => 'longtext',
                'tags' => 'tags',  
                'access_id' => 'access',
                'write_access_id' => 'access',
            );
          
    And you should leave it as
            $CONFIG->pages = array(
                'title' => 'text',
                'field1' => 'text',
                'field2' => 'text',
                'calendar' => 'calendar',
                'description' => 'longtext',
                'tags' => 'tags',  
                'access_id' => 'access',
                'write_access_id' => 'access',
            );

    To make it appear in the page profile view.
    you should add the following code to the line 34 of the file /elgg1.7.1/mod/pages/views/default/pages/pageprofile.php
            echo elgg_view('output/longtext', array('value' => $entity->field1));
            echo elgg_view('output/longtext', array('value' => $entity->field2));
            echo elgg_view('output/longtext', array('value' => $entity->calendar));

    2 - Links
    For not showing the links in the top bar.
    File: /mod/pages/start.php
    Comment line 23 and 27 with //
    This is for not show the page link in the tools

    For not showing the "New Page" link.
    File: /mod/pages/index.php
    Comment line 23
    Add the following code at line 26
        if (($owner instanceof ElggEntity) && ($owner instanceof ElggGroup)){
            add_submenu_item(elgg_echo('pages:new'), $CONFIG->url . "pg/pages/new/?container_guid=" . page_owner(), 'pagesactions');
        }


    3 - The action
    Filter who can create pages.
    File: /mod/pages/actions/pages/edit.php
    Add the following code in line 58
            // This is only allowed for admins or groups owner
            $object = get_entity($container_guid);
            if($object->type != 'group')
            {
                register_error(elgg_echo('pages:are:just:for:groups'));
                forward();
            }
            else // This is a group but we need to check if this is an admin or the owner of the group
            {
                if (!isadminloggedin() && $object->owner != $_SESSION['user']->getGUID())
                {
                    register_error(elgg_echo('pages:are:just:for:groups'));
                    forward();
                }
                   
            }
           
    4 - Language
    File: /mod/pages/languages/en.php       
    ADd the following code at line 109
            /**
             * Limitation just for groups
             */
                'pages:are:just:for:groups' => "The page's creation is just allowed for admin and group's owners.",

  • @gushbellino -- u really rock man and ur helps are outstanding. people like u only hav kept this support running fine. i was helpless, nd unable to do it but then u struck the right chords and make it happen. thank you for help.

    things are working fine for the site admin. but group owner still can't create the page (pls remember that normal group member will not be able to create a page)

    i think we have done so far so the group owner creating page thing will also be done.

    thanx a lot

     

     

  • @gushbellino - - thank u  a lot man this is really a gr8.

    Hey one more thing the donation button, can we make it page specific. I have added the donation mod and even being able to bring the thing on left side. here is a viewDonation in pagebbut i dont get a link that will redirect me to the paypal, can be done ????

  • @gushbellino excellent task.Thanks a lot.

    Everything works well,but group owner cannot create page,only admin can.I want these for admin as well as group owner not for any group members.

    Also I want to add open and close option in comments when Admin/group owner select close options the page  comments will invisible,that is no one can post a comment but the page will remain same without comment options.

    Also I want to add page specific donation which will directly go to paypal option for payment.

    Thanks and regards,

     

  • Hello guys,

    @dwaipayan and @rahulneo, this is strange, it works for me. The if line:

    if (!isadminloggedin() && $object->owner != $_SESSION['user']->getGUID())

    should give an error when it is not and admin and it is not the owner of the group. Can you check what is the $object->owner value?

    Maybe I will create a plugin and upload it with the comments functionality (but I do not have the time this week)

    @elgglearne, you should create the button correctly from paypal.

    Regards.

     

  • @gushbellino  -- how do i check the value of $object->owner value??

    i have tried to echo it but in vain and could not get the value...

    thanks for the help...

  • @gushbellino -- i think i will be able to bring the donation button. thanks for ur support and help.

    one more thing is that is it possible to bring the site wide category in the a pulldown/dropdown list on the page ??? currently it is shown in a checkbox form one after another

    thanks for ur esteemed support

  • @gushbellino Everything works well except page creation.Site admin can create page but group owner cannot.Thanks for your help and cooperation.You r the only person who can support for my work.

    Many many thanks.

    One small demand the fields that you help me to add are venue,benifits,amount,budget,start and end date,category(site wide category).I want this is also searchable(beside site wide search).I want to add a search specially for page,so that anyone can serach by this fileds and get relevent informations,that is page specific search.Whenever you are free please do it for me.It will be better if you post it in plugins.

    This is also applicable for site wide category(which will show in drop down rather than checkbox).

    Thanks and regards.

  • @gushbellino I know that you are busy .Whenever you are free please do it for me. It will better if you create a new plugins for group.

    Thanks and regards,

  • @gushbellino,R u busy? Can you post plugins for all these requirements?

    1)Project specific search(search each and every added fields including category(which will display in dropdown)) beside site wide category.

    Thanks a lot for your great effort.