Editing Activity Timeline

derrickhand300
@derrickhand300
8 years ago
1,353 posts
I am using the following template code to add an activity feed to my HOME page
{jrCore_list module="jrAction" profile_id=$_profile_id include_followed=true order_by="_item_id numerical_desc"}
My question is...
Is there a way to add the ability of an admin to delete these items directly from the HOME page Activity Feed?9Just want to exclude them from the fee and not site...-Maybe an X or DELETE icon next to each item?
I am after the ability to edit these as admin by just acessing the home page and not having to enter the datastore each time...similar to FB stuff..
IF this is not possible -then in which ACP module would I find all the activity to edit?
Thanks
updated by @derrickhand300: 12/25/16 02:11:31PM
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
derrickhand300:
IF this is not possible -then in which ACP module would I find all the activity to edit?
Thanks

http://yoursite.com/timeline/dashboard/browser ...at least, that's where I do it.


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Thanks Strumela- I could not find that this morning to save my butt! I THINK there is a way to take some template code from somewheres and add that to this template to add the delete buttons to the timeline...I am confident I could work that out but I think what it would end up doing is deleting the content site wide...what i would really like is just to have a X in the corner of each item in the timeline that as an admin I could check to remove it from the timeline without removing it site wide.
I appreciate the link- thanks again
michael
@michael
8 years ago
7,746 posts
The delete button will show up on the timeline of the profile where it was posted and you can delete it from there. But because the activity timeline on the HOME page is not on a profile, there is a chance that the wrong profile will be selected as the current profile so confusion could happen.

Thats why the buttons don't show.

You could wrap it in an {if jrUser_is_admin()} and add this link:
http://your-site.com/timeline/delete/id=222

Just replace the id=222 with the item_id of the action inside the foreach loop of item_list.tpl of the jrAction module (or whichever location you've chosen to override it)

Probably look something like this:
    {foreach $_items as $item}
{if jrUser_is_admin()}
  <a href="{$jamroom_url}/timeline/delete/id={$item._item_id}">X</a>
{/if}
.........
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Thanks Michael!
One question though- using this code- will it just remove posts from the activity timeline OR will it remove the posts from the website? (also seems to be a syntax error in the code)
updated by @derrickhand300: 09/08/16 04:25:34AM
michael
@michael
8 years ago
7,746 posts
posts from the website, delete = gone.

michael adds a video. Michaels video add gets added to the timeline "Michael added a video". Curtis deleted "Michael added a video".

Video still exists, but timeline entry is gone.
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Yes- thats what I am after- I will work at it more here- thanks again man
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Do you happen top see the syntax error in the above?
douglas
@douglas
8 years ago
2,793 posts
derrickhand300:
Do you happen top see the syntax error in the above?

Other than the missing closing foreach tag?

{foreach $_items as $item}
{if jrUser_is_admin()}
  <a href="{$jamroom_url}/timeline/delete/id={$item._item_id}">X</a>
{/if}
{/foreach}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Thank you- yes that was it... I saw the /if and thought that was the end...Thanks Douglas
douglas
@douglas
8 years ago
2,793 posts
Your welcome, I think it would be better if it were written like this instead:

{if jrUser_is_admin()}
{if isset($_items)}
{foreach $_items as $item}
  <a href="{$jamroom_url}/timeline/delete/id={$item._item_id}">X</a>
{/foreach}
{/if}
{/if}

that way the loop isn't trying to run for everyone, just the admin user.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
Quote: that way the loop isn't trying to run for everyone, just the admin user.

Douglas, the way you have it written above...will that work for the Profile Admins as well as the master admin then?


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
douglas
@douglas
8 years ago
2,793 posts
Strumelia:
Quote: that way the loop isn't trying to run for everyone, just the admin user.
Douglas, the way you have it written above...will that work for the Profile Admins as well as the master admin then?

I think so, the master admin is an admin user, I've not tested this though.

If not just add in the master admin like this:

{if jrUser_is_admin() || jrUser_is_master()}
{if isset($_items)}
{foreach $_items as $item}
  <a href="{$jamroom_url}/timeline/delete/id={$item._item_id}">X</a>
{/foreach}
{/if}
{/if}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
Hi Douglas- I mean I would want BOTH the master admin and the profile admins to be able to delete an item directly from the Activity Feed (but not delete it completely from the site itself).


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Thanks Douglas...this gets me very close....but I have a row of XXXXXXX above all the items in the activity feed instead of on each item in the activity feed... got Developer-Network helping me to figure it out :)
It will be cool to be able to fine tune the activity feed on home page without having to enter the datastore:)
Capture.JPG.jpg
Capture.JPG.jpg  •  86KB


updated by @derrickhand300: 09/09/16 11:28:23AM
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
Add this list:
{jrCore_list module="jrAction" profile_id=$_profile_id include_followed=true order_by="_item_id numerical_desc" template="remove_activity.tpl" }


Add this template to your skin remove_activity.tpl
{if isset($_items)}

    {if (jrCore_module_is_active('jrComment') && $_items[0].quota_jrComment_allowed == 'on') || (jrCore_module_is_active('jrDisqus') && $_items[0].quota_jrDisqus_allowed == 'on')}
        {assign var="img" value="comments.png"}
        {jrCore_lang module="jrAction" id="22" default="Comments" assign="alt"}
    {else}
        {assign var="img" value="link.png"}
        {jrCore_lang module="jrAction" id="23" default="Link To This" assign="alt"}
    {/if}

    {jrCore_module_url module="jrAction" assign="murl"}
    {foreach from=$_items item="item"}
        {if jrUser_is_admin()}
            {if isset($_items)}
                <div style="float: right;">
                   <a href="{$jamroom_url}/timeline/delete/id={$item._item_id}">X</a>
                </div>
            {/if}
        {/if}
        {* Shared Action *}
        {if isset($item.action_original_profile_url)}

            <div id="a{$item._item_id}" class="action_item_holder_shared">
                <div class="container">
                    <div class="row">



                        <div class="col2">
                            <div class="action_item_media" title="{$item.action_original_profile_name|jrCore_entity_string}" onclick="jrCore_window_location('{$jamroom_url}/{$item.action_original_profile_url}/{$murl}/{$item.action_original_item_id}')">
                                {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item.action_original_user_id size="icon" crop="auto" alt=$item.user_name class="action_item_user_img img_shadow img_scale"}
                            </div>
                        </div>

                        <div class="col10 last" style="position:relative">

                            <div id="d{$item._item_id}" class="action_item_delete">
                                <script>$(function () { $('#a{$item._item_id}').hover(function() { $('#d{$item._item_id}').toggle(); }); });</script>
                                {jrCore_item_delete_button module="jrAction" profile_id=$item._profile_id item_id=$item._item_id}
                            </div>

                            <div class="action_item_desc">

                                <a href="{$jamroom_url}/{$item.action_original_profile_url}" class="action_item_title" title="{$item.action_original_profile_name|jrCore_entity_string}">@{$item.action_original_profile_url}</a> <span class="action_item_actions">&bull; {$item._created|jrCore_date_format:"relative"} &bull; {jrCore_lang module="jrAction" id="21" default="Shared By"} <a href="{$jamroom_url}/{$item.profile_url}" title="{$item.profile_name}">@{$item.profile_url}</a></span><br>

                                <div class="action_item_link" title="{$item.action_original_profile_name|jrCore_entity_string}" onclick="jrCore_window_location('{$jamroom_url}/{$item.action_original_profile_url}');">
                                    {if isset($item.action_data) && strlen($item.action_data) > 0}
                                        {$item.action_data}
                                    {else}
                                        <div class="p5">{$item.action_text|jrCore_format_string:$item.profile_quota_id|jrAction_convert_hash_tags}</div>
                                    {/if}
                                </div>

                            </div>
                        </div>

                    </div>
                </div>
            </div>

            {* Activity Updates *}
        {elseif isset($item.action_text)}

            <div id="a{$item._item_id}" class="action_item_holder">
                <div class="container">
                    <div class="row">

                        <div class="col2">
                            <div class="action_item_media" onclick="jrCore_window_location('{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}')">
                                {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="icon" crop="auto" alt=$item.user_name class="action_item_user_img img_shadow img_scale"}
                            </div>
                        </div>
                        <div class="col10 last" style="position:relative">

                            <script>$(function() { $('#a{$item._item_id}').hover(function() { $('#d{$item._item_id}').toggle(); }); });</script>
                            <div id="d{$item._item_id}" class="action_item_delete">
                                {jrCore_item_update_button module="jrAction" profile_id=$item._profile_id item_id=$item._item_id}
                                {jrCore_item_delete_button module="jrAction" profile_id=$item._profile_id item_id=$item._item_id}
                            </div>

                            <div class="action_item_desc">

                                <a href="{$jamroom_url}/{$item.profile_url}" class="action_item_title" title="{$item.profile_name|jrCore_entity_string}">@{$item.profile_url}</a> <span class="action_item_actions">&bull; {$item._created|jrCore_date_format:"relative"}{if jrUser_is_logged_in() && $_user._user_id != $item._user_id && $item.action_shared_by_user != '1'} &bull; <a href="{$jamroom_url}/{$murl}/share/{$item._item_id}" onclick="if(!confirm('{jrCore_lang module="jrAction" id="9" default="Share this update with your followers?"}')) { return false; }">{jrCore_lang module="jrAction" id="10" default="Share This"}</a>{/if} {if $_post.module_url == $_user.profile_url && $item.action_shared_by_user == '1'} &bull; <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}">{jrCore_lang module="jrAction" id="26" default="shared by you"}</a> {elseif $item.action_shared_by_count > 0} &bull; {jrCore_lang module="jrAction" id="24" default="shared by"} <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}">{$item.action_shared_by_count} {jrCore_lang module="jrAction" id="25" default="follower(s)"}</a>{/if}{if $img == "comments.png"} &bull; <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}">{jrCore_lang module="jrAction" id="22" default="Comments"}: {$item.action_comment_count|default:0}</a>{/if}</span><br>

                                <div class="action_item_link">
                                    <div class="p5">{$item.action_text|jrCore_format_string:$item.profile_quota_id|jrAction_convert_hash_tags}</div>
                                </div>

                            </div>
                        </div>

                    </div>
                </div>
            </div>

            {* Registered Module Action templates *}
        {elseif isset($item.action_data) && strpos($item.action_data, '{') !== 0}

            {jrCore_module_url module=$item.action_module assign="lurl"}

            <div id="a{$item._item_id}" class="action_item_holder">
            <div class="container">
            <div class="row">

            <div class="col2">
            {if isset($item.album_title_url)}
                <div class="action_item_media" onclick="jrCore_window_location('{$jamroom_url}/{$item.profile_url}/{$lurl}/albums/{$item.album_title_url}')">
            {elseif isset($item.action_title_url)}
                <div class="action_item_media" onclick="jrCore_window_location('{$jamroom_url}/{$item.profile_url}/{$lurl}/{$item.action_item_id}/{$item.action_title_url}')">
            {else}
                <div class="action_item_media">
            {/if}
            {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="icon" crop="auto" alt=$item.user_name class="action_item_user_img img_shadow img_scale"}
            </div>
            </div>
            <div class="col10 last" style="position:relative">

                <script>$(function() { $('#a{$item._item_id}').hover(function() { $('#d{$item._item_id}').toggle(); }); });</script>
                <div id="d{$item._item_id}" class="action_item_delete">
                    {jrCore_item_delete_button module="jrAction" profile_id=$item._profile_id item_id=$item._item_id}
                </div>

                <div class="action_item_desc">

                    <a href="{$jamroom_url}/{$item.profile_url}" class="action_item_title" title="{$item.profile_name|jrCore_entity_string}">@{$item.profile_url}</a> <span class="action_item_actions">&bull; {$item._created|jrCore_date_format:"relative"}{if jrUser_is_logged_in() && $_user._user_id != $item._user_id && $item.action_shared_by_user != '1'} &bull; <a href="{$jamroom_url}/{$murl}/share/{$item._item_id}" onclick="if(!confirm('{jrCore_lang module="jrAction" id="9" default="Share this update with your followers?"}')) { return false; }">{jrCore_lang module="jrAction" id="10" default="Share This"}</a>{/if} {if $_post.module_url == $_user.profile_url && $item.action_shared_by_user == '1'} &bull; <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}">{jrCore_lang module="jrAction" id="26" default="shared by you"}</a> {elseif $item.action_shared_by_count > 0} &bull; {jrCore_lang module="jrAction" id="24" default="shared by"} <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}">{$item.action_shared_by_count} {jrCore_lang module="jrAction" id="25" default="follower(s)"}</a>{/if}</span><br>

                    {if isset($item.album_title_url)}
                    <div class="action_item_link" onclick="jrCore_window_location('{$jamroom_url}/{$item.profile_url}/{$lurl}/albums/{$item.album_title_url}')">
                        {elseif isset($item.action_title_url)}
                        <div class="action_item_link" onclick="jrCore_window_location('{$jamroom_url}/{$item.profile_url}/{$lurl}/{$item.action_item_id}/{$item.action_title_url}')">
                            {else}
                            <div class="action_item_link">
                                {/if}
                                {$item.action_data}
                            </div>

                        </div>
                    </div>

                </div>
            </div>
            </div>

        {/if}


    {/foreach}

{/if}
michael
@michael
8 years ago
7,746 posts
derrickhand300:
Do you happen top see the syntax error in the above?

The closing foreach was not in there because there is a TON more stuff in that template to actually show the activity timeline items.
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Thanks Michael
I just noticed BLOGS are not showing up in the activity timeline- even when the checkbox "ADD TO TIMELINE" is checked..
I am using the following template code
{jrCore_list module="jrAction" profile_id=$_profile_id include_followed=true order_by="_item_id numerical_desc" template= "remove_activity.tpl"}
I have seen looking at creating an item list using seamless in sitebuilder but ACTIVITY does not seem to be included...can it be added to the above template code manually?
michael
@michael
8 years ago
7,746 posts
Throw a {debug} OUTSIDE the foreach loop in the remove_activity.tpl file and see if any blog posts are contained in the $_items array.

Need to figure out if the blog posts are:
* not getting included in the requested results OR
* included but not getting displayed on the page OR
* not getting saved to the activity timeline datastore.

My guess is #2.
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Thanks Michael
Here is what I see in $_items ( some are repeating)

profile_jrBlog_item_count => "1"
quota_jrBlog_allowed => "on"
quota_jrBlog_max_items => "0"
quota_jrBlog_pending => "0"
user_jrBlog_item_count => "1"
profile_jrBlog_item_count => "1"
quota_jrBlog_allowed => "on"
quota_jrBlog_max_items => "0"
quota_jrBlog_pending => "0"
profile_jrBlog_item_count => "1"
quota_jrBlog_allowed => "on"
quota_jrBlog_max_items => "0"
quota_jrBlog_pending => "0"
michael
@michael
8 years ago
7,746 posts
putting {debug} into
ACP -> MODULES -> PROFILES -> TIMELINE -> TEMPLATES -> item_list.tpl -> MODIFY

at the top, then writing a blog entry shows that entry in the $_items array for me.
derrickhand300
@derrickhand300
8 years ago
1,353 posts
Mine is showing
blog item count=0
Even though there is one blog currently on the site
I must have something wrong in the blog settings?
Capture.JPG.jpg
Capture.JPG.jpg  •  64KB

joanna
@joanna
8 years ago
88 posts
Hi :)
I love this tip and am working at adding this tiny X to the activity on the home page, but probably I do something wrong or I miss something. I'm just not a programmer and would be grateful for any tips how to solve my challenge.

I use the Site Builder to create our home page. I use widget Timeline. I loaded Custom Template and added the code suggested by @douglas there:
Quote:
{if jrUser_is_admin()}
{if isset($_items)}
{foreach $_items as $item}
X
{/foreach}
{/if}
{/if}

I see nice X in each activity, but when I click on it, each time a new page is open with information "This Page Does Not Exist."
What did I miss? Or maybe I should add the above code in the other place, not inside the custom code in the widget.
michael
@michael
8 years ago
7,746 posts
@joanna, If I'm understanding what you're after, you want a delete button on the timeline that is displayed on your home page.

There is some code for that here:
https://www.jamroom.net/the-jamroom-network/forum/new_posts/43430/data-browser-truncates-out-timeline-profile-id-s-that-i-need#p43510
Holly Dilatush
Holly Dilatush
@holly-dilatush
8 years ago
212 posts
Hi Michael,
I'm writing for Joanna (she 'gets' this stuff much better than I do. I'd be lost without her).

It appears from our reading of the discussions in the link you suggested [https://www.jamroom.net/the-jamroom-network/forum/new_posts/43430/data-browser-truncates-out-timeline-profile-id-s-that-i-need#p43510] that you will have to add something to our site?

You wrote:
Quote: Yes this is the index_activity.tpl template:
ACP -> SKINS -> (your current skin) -> TEMPLATES -> index_activity.tpl -> MODIFY

I've added it to your site. The action is exactly the same as if the DELETE button was pressed from the Data Browser.

If you find the cache clearing is an issue, get your moderators to write on their timeline after they're done deleting, that should sort the cache out.

So, Joanna and I are thinking that we need to beg you to add this to lewwwpcom.jamroomhosting.com too?

Please, please, pretty please?
Thank you,
Holly & Joanna
michael
@michael
8 years ago
7,746 posts
The code is all there, in that post, if Joanna is more familiar it will make sense to her.

If not I can add it, rather not though as its just a template alteration that I'm hoping doesn't seam like a daunting thing.
joanna
@joanna
8 years ago
88 posts
@michael - thank you for believing in me. :)
However, I would be grateful for your help. Could you please add it to our site lewwwpcom.jamroomhosting.com.

I'm still learning and trying to understand the code you use to write all of these features. Many things I just guess. I tried to put that code in many places in index_activity.tpl but each time I failed.
Thank you for you help.
Joanna
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
Joanna, I think you may be missing a little detail somehow in the explanation from the other thread. Try it again:
In your ACTIVE (custom) skin, go to the templates and Modify the index_activity.tpl.
To do it like michael described in the other thread, first note that you must add the first bit of new code in THREE places in the template: you'll be adding the code immediately after it says
{jrCore_item_delete_button module="jrAction" profile_id=$item._profile_id item_id=$item._item_id}
, (but before the closing div that comes right after it each time) -note that line of code occurs three times in the template- so add the following code THREE times (once after each of the repeated lines above):
{if jrUser_is_admin() && !jrProfile_is_profile_view()}
                        <a onclick="xxDeleteEntry('{$item._item_id}');">{jrCore_icon icon="trash" size=30}</a>
                        {/if} 
Finally, as Michael suggests in the other thread, add this code once at the VERY BOTTOM, after everything else:
<script>
    function xxDeleteEntry(id) {
        if (confirm('Are you sure you want to Delete this timeline entry?')) {
            var url = core_system_url + '/' + jrAction_url + '/browser_item_delete/id=' + id + '/__ajax=1';
            jrCore_set_csrf_cookie(url);
            $.get(url, function (r)
            {
                $('#a' + id).fadeOut();
            });
        }
    }
</script>
Be sure to SAVE your change, then go back to the templates list and remember to CHECK the little box that activates your new change, and SAVE at bottom again. Clear your CACHE, and perhaps you will see the change on your main index page activity feed when you refresh that page?



--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 09/24/16 06:04:02PM
joanna
@joanna
8 years ago
88 posts
@strumelia Thank you :)
I wonder why it didn't want to work yesterday for me.
Today I also wanted to give up because when I did it in my index_activity.tpl it didn't want to work, either.
In my SiteBuilder I loaded a default template and added the code there.
YAY, it works perfectly now.

You're all awesome. :)
Joanna
michael
@michael
8 years ago
7,746 posts
Nice one.

PROBABLY.... the issue was the template active checkbox wasn't checked. Its an important step but often gets missed.

Glad you got it working though. Well done.

--
Check out the screenshot here to see that 'active' checkbox
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-admin-handbook/3183/using-the-template-editor#saving-your-changes
updated by @michael: 09/25/16 02:01:44AM

Tags