Access levels in thewire

Hi

I'm trying add access to 'thewire' 1.8.  I've managed to get the access chooser (access plus)

and it's set as the default site access but non-friends' wire posts can still be viewd in the river. How do I get the activity view to pay attention to the access level?

This is my code from mod/thewire/views/default/forms/thewire/add.php:

<?php

elgg_load_js('elgg.thewire');

 

$post = elgg_extract('post', $vars);

$access_id = elgg_extract('access_id', $vars, ACCESS_FRIENDS);

$text = elgg_echo('post');

.............................................................................................................................................

?>

<div>

<label><?php echo elgg_echo('access'); ?></label><br />

<?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?>

</div>

<div>

<?php

 

echo elgg_view('input/submit', array(

'value' => $text,

'id' => 'thewire-submit-button',

));

?>

</div>

If some one could take the time to give me a pointer on where I'm making my mistake...

thanks

Regards

  • In the action that creates a new thewire object.

  • Just incase anyone like me was wondering LOL:

     

    thewire/actions/add.pnp

    At the to of the page add this line:

     

    $access_id = get_input('access_id');

    $description = get_input('description');

    $method = 'site';

    $parent_guid = (int) get_input('parent_guid');

     

     

    thewire/views/default/forms/add.php

    At the top add this line to set the default selection for that access picker:

    $access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT);

    Change "DEFAULT" for one of your choice EG: ACCESS_DEFAULT; ACCESS_PUBLIC; ACCESS_FRIENDS


    Add this code at the buttom or wherever you want the access picker to apear:

     

    ?>

    <div>

         <?php echo elgg_echo('access'); ?></label><br />

         <?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?>

    </div>

    <div>

    <?php

     

    Regards

     

  • @stumpy: Its really a good idea but still.. i get the access chooser at the wire.. when i post a comment in the wire.. still users r able to see my comment.. I am using elgg 1.8.3

    I added the code as u said.. but as i am new to elgg & dont know any thing about php can u plz help me i will post u the code & can u tell me where i am just making a mistake..

    thewire/actions/add.php

    <?php

    $access_id=get_input('access_id');

     

     $description = get_input('description');

    $method = 'site';

    $parent_guid = (int) get_input('parent_guid');

    // don't filter since we strip and filter escapes some characters

    $body = get_input('body', '', false);

    $access_id = ACCESS_PUBLIC;

    $method = 'site';

    $parent_guid = (int) get_input('parent_guid');

    // make sure the post isn't blank

    if (empty($body)) {

    register_error(elgg_echo("thewire:blank"));

    forward(REFERER);

    }

    $guid = thewire_save_post($body, get_loggedin_userid(), $access_id, $parent_guid, $method);

    if (!$guid) {

    register_error(elgg_echo("thewire:error"));

    forward(REFERER);

    }

    // Send response to original poster if not already registered to receive notification

    if ($parent_guid) {

    thewire_send_response_notification($guid, $parent_guid, $user);

    $parent = get_entity($parent_guid);

    forward("thewire/thread/$parent->wire_thread");

    }

    system_message(elgg_echo("thewire:posted"));

    forward(REFERER);

    thewire/views/default/forms/add.php

    <?php

    /**

     * Wire add form body

     *

     * @uses $vars['post']

     */

     $access_id = elgg_extract('access_id', $vars, ACCESS_FRIENDS);

     

    elgg_load_js('elgg.thewire');

     

    $post = elgg_extract('post', $vars);

     

    $text = elgg_echo('post');

    if ($post) {

    $text = elgg_echo('thewire:reply');

    }

     

    if ($post) {

    echo elgg_view('input/hidden', array(

    'name' => 'parent_guid',

    'value' => $post->guid,

    ));

    }

     

    echo elgg_view('input/plaintext', array(

    'name' => 'body',

    'class' => 'mtm',

    'id' => 'thewire-textarea',

    ));

    ?>

    <div id="thewire-characters-remaining">

    <span>140</span> <?php echo elgg_echo('thewire:charleft'); ?>

    </div>

    <div class="elgg-foot mts">

    <?php

    ?>

    <div>

    <label><?php echo elgg_echo('who can view this');  ?></label><br />

    <?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?>

    </div>

    ?>

     

    <div>

    <?php

    echo elgg_view('input/submit', array(

    'value' => $text,

    'id' => 'thewire-submit-button',

    ));

    ?>

    </div>

     

  • $access_id=get_input('access_id');

    $access_id = ACCESS_PUBLIC;

     

    You are defining access id twice. Replace with 

    $access_id = get_input('access_id', ACCESS_PUBLIC);

  • @Ismayil: Thanks for your reply.. All ur hype plugins just Rock.. as u said i changed the code.. but still not working & it will be helpfull if u can tell little bit more clear bcz i dont know php... & thanks for spending ur time :)

    thewire/actions/add.php

    $access_id = get_input('access_id');

    $body = get_input('body', '', false);

    $method = 'site';

    $parent_guid = (int) get_input('parent_guid');

     

     

     

     

    // make sure the post isn't blank

    if (empty($body)) {

    register_error(elgg_echo("thewire:blank"));

    forward(REFERER);

    }

     

    $guid = thewire_save_post($body, get_loggedin_userid(), $access_id, $parent_guid, $method);

    if (!$guid) {

    register_error(elgg_echo("thewire:error"));

    forward(REFERER);

    }

     

    // Send response to original poster if not already registered to receive notification

    if ($parent_guid) {

    thewire_send_response_notification($guid, $parent_guid, $user);

    $parent = get_entity($parent_guid);

    forward("thewire/thread/$parent->wire_thread");

    }

     

    system_message(elgg_echo("thewire:posted"));

    forward(REFERER);

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking