Help with Status update code

Jamie

Well-known member
Ok, so I have converted my site and want to focus on the forums and it's options, so I have made the recent activity area my "home" page. (would be nice if I could get it to highlight the home tab instead of the member tab, but that's minor.)


One thing I did was copy the status update box from the profile page and place it in the news feed box, which now shows up nicely on my front page.

frontpage.webp


This only shows for registered members.

It works, but when I enter the update the page doesn't automatically refresh like it does on the profile page. If you enter an update and then refresh the page or go to another page and come back, the new status update is there, it just doesn't do it 'cool like' the profile page.

What did I miss to make this cool and smooth?

Thanks!
Jamie
 
By the way, here is what I did to add this:

In the newsfeed template:

Add this to the top of the template:

Code:
<xen:require js="js/xenforo/personal_details_editor.js" />

Find:

Code:
<xen:if is="{$newsFeed}">

Add this code above it:

Code:
<!-- Status Update on News Feed -->
<xen:if is="{$visitor.user_id}">
<form method="post" class="xenForm personalDetailsForm AutoValidator"
    action="{xen:link 'account/personal-details-save'}"
    data-fieldValidatorUrl="{xen:link 'account/validate-field.json'}">

    <dl class="ctrlUnit">
        <dt><label for="ctrl_status">{xen:phrase status_message}:</label></dt>
        <dd>
            <textarea name="status" rows="2" cols="60" id="ctrl_status" autofocus="autofocus" class="textCtrl StatusEditor Elastic OptOut" data-statusEditorCounter="#statusEditorCounter"></textarea>
            <span id="statusEditorCounter" title="{xen:phrase characters_remaining}"></span>
            <div class="explain"><h3 class="statusHeader">{xen:phrase current_status}:</h3> <span class="CurrentStatus"><xen:if is="{$visitor.status}">{xen:string censor, $visitor.status}<xen:else />({xen:phrase none})</xen:if></span><!--TODO: clearing--></div>
        </dd>
    </dl>

    <xen:if hascontent="true">
        <fieldset>
            <xen:contentcheck>
                <xen:if is="{$canEditAvatar}">
                    <dl class="ctrlUnit avatarEditor">
                        <dt><label>{xen:phrase avatar}:</label></dt>
                        <dd>
                            <xen:avatar user="$visitor" size="m" class="OverlayTrigger" href="{xen:link account/avatar}" />
                            <p class="explain">{xen:phrase click_image_to_change_your_avatar}</p>
                        </dd>
                    </dl>
                </xen:if>
                
                <xen:if is="{$canEditCustomTitle}">
                    <dl class="ctrlUnit">
                        <dt><label for="ctrl_custom_title">{xen:phrase custom_title}:</label></dt>
                        <dd>
                            <input type="text" name="custom_title" value="{$visitor.custom_title}" id="ctrl_custom_title" class="textCtrl" />
                            <p class="explain">{xen:phrase if_specified_replace_title_that_displays_under_name_in_posts}</p>
                        </dd>
                    </dl>
                </xen:if>
            </xen:contentcheck>
        </fieldset>
    </xen:if>
    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>
</xen:if>
<br />
 
Ok, I am not sure if I put it in the right place, but it didn't work. I added it to the end of the input type line. If that was wrong, can you tell me where to place it?

Thanks for your help!
Jamie

Code:
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" / data-redirect="on">
 
Ok, I am not sure if I put it in the right place, but it didn't work. I added it to the end of the input type line. If that was wrong, can you tell me where to place it?

Thanks for your help!
Jamie

Code:
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" / data-redirect="on">

i think it should be before the forward slash. Not sure though.
 
Try adding it to the form tag like this: :)
HTML:
<form method="post" class="xenForm personalDetailsForm AutoValidator"
    action="{xen:link 'account/personal-details-save'}"
    data-fieldValidatorUrl="{xen:link 'account/validate-field.json'}" data-redirect="on">
 
Hum, that didn't seem to work either.. this is one of those times where I miss I knew more than I do. :)

Jamie
 
What you're asking for is a fairly significant modification - you need to intercept the status message being posted by hooking in to the events fired by the XenForo.AutoValidator Javascript class and load the appropriate template - it's really not the kind of thing that can be covered in a reply here. You'll get some ideas about how all this works from the next video I'm going to post into the AJAX Developer Demo thread in 'Have You Seen...'.
 
Thanks guys for the help. I look forward to the next video... at some point it looks like I am going to learn to code/understand code which is a good thing. :)

Thanks again!
Jamie
 
Jamie, did you ever get this going?

That approach (recent activity as 'homepage' with the status update at top) is the exact thing that I want on my next site.
 
Hey ArnyVee,

I haven't gotten it working.. It's something I really need for me site as well, I am going to start looking for someone to hire to handle it for me I think.

Jamie
 
What do you exactly want?
I haven't understand what you already have/what's missing.
 
What do you exactly want?
I haven't understand what you already have/what's missing.

Ragtek,

When you update your status on the profile page, it automatically updates the status and displays it without a page refresh.

What we are looking to do is to take the "Recent Activity" page and make it act the same way by adding the 'status update' field above the activity/updates and then making it automatically update without a page refresh.

While we're at it, I'd like the ability to "like" or "comment" on each of the recent activity actions as well. :D
 
By the way, here is what I did to add this:

In the newsfeed template:

Add this to the top of the template:

Code:
<xen:require js="js/xenforo/personal_details_editor.js" />

Find:

Code:
<xen:if is="{$newsFeed}">

Add this code above it:

Code:
<!-- Status Update on News Feed -->
<xen:if is="{$visitor.user_id}">
<form method="post" class="xenForm personalDetailsForm AutoValidator"
    action="{xen:link 'account/personal-details-save'}"
    data-fieldValidatorUrl="{xen:link 'account/validate-field.json'}">

    <dl class="ctrlUnit">
        <dt><label for="ctrl_status">{xen:phrase status_message}:</label></dt>
        <dd>
            <textarea name="status" rows="2" cols="60" id="ctrl_status" autofocus="autofocus" class="textCtrl StatusEditor Elastic OptOut" data-statusEditorCounter="#statusEditorCounter"></textarea>
            <span id="statusEditorCounter" title="{xen:phrase characters_remaining}"></span>
            <div class="explain"><h3 class="statusHeader">{xen:phrase current_status}:</h3> <span class="CurrentStatus"><xen:if is="{$visitor.status}">{xen:string censor, $visitor.status}<xen:else />({xen:phrase none})</xen:if></span><!--TODO: clearing--></div>
        </dd>
    </dl>

    <xen:if hascontent="true">
        <fieldset>
            <xen:contentcheck>
                <xen:if is="{$canEditAvatar}">
                    <dl class="ctrlUnit avatarEditor">
                        <dt><label>{xen:phrase avatar}:</label></dt>
                        <dd>
                            <xen:avatar user="$visitor" size="m" class="OverlayTrigger" href="{xen:link account/avatar}" />
                            <p class="explain">{xen:phrase click_image_to_change_your_avatar}</p>
                        </dd>
                    </dl>
                </xen:if>

                <xen:if is="{$canEditCustomTitle}">
                    <dl class="ctrlUnit">
                        <dt><label for="ctrl_custom_title">{xen:phrase custom_title}:</label></dt>
                        <dd>
                            <input type="text" name="custom_title" value="{$visitor.custom_title}" id="ctrl_custom_title" class="textCtrl" />
                            <p class="explain">{xen:phrase if_specified_replace_title_that_displays_under_name_in_posts}</p>
                        </dd>
                    </dl>
                </xen:if>
            </xen:contentcheck>
        </fieldset>
    </xen:if>
    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>
</xen:if>
<br />
Why do you use the avatar and customtitle code here?
 
Why do you use the avatar and customtitle code here?

That was me just messing around and testing out if I could get it working. I know almost nothing when it comes to coding so I was just copying a chunk of code and pasting it in.. which didn't work out well.

ArnyTee is correct... like him I am looking for a way to get my members more active on the recent activity screen.. ideally what I would like is to mimic facebook with the quickness and ease of posting status updates and keeping people in the loop with life, and then for deeper discussions we would use our forums in place for this.

I am tring to mesh together the best of both worlds... the facebook (post a lot of status updates to keep people involved with each other's lives) backed by the power of a forum where real discussions could be had.

Make sense? I am really bad at describing what I ideally want sadly.. :(

Jamie
 
Back
Top Bottom