asechrest
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedMaybe I’ll throw this all in a plugin with a short options screen just for practice. Never written one before.
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedMy theme has the comment callback, so I guess I got lucky when testing. I’m not clear on why the callback is required for the filter to work on
wp_list_comments()though. (I guess the other way to list comments would be a regular comments loop?)Forum: Fixing WordPress
In reply to: Side Bar at bottom of pageLink to your site please and the post that pushed the sidebar to the bottom.
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedOk, had a little bit of time to hash out a basic structure. Here’s what I have so far (with most of the credit to t31os). I used the strategy in that link you gave, t31os.
Currently this simply tests to see if a comment is made from a Mozilla agent, and if not it appends “Not…Mozilla…” to the end of the comment.
I’ve still got to finish the coding and make it more efficient, but what do you guys think so far? Tips and criticisms welcomed.
add_filter( 'comment_text', 'mobilesig' ); function mobilesig ($mytext) { //GLOBALS global $comment; //VARIABLES $mytext; $is_mobile = false; $str_comment_agent = strtolower($comment->comment_agent); // !== OPERATOR TAKES PRECENDENCE. See http://www.php.net/manual/en/language.operators.comparison.php //EVALUATES TO TRUE OR FALSE (1 OR 0) AND ASSIGNS TO $is_mobile $is_mobile = strpos($str_comment_agent, 'moz') !== false; if (!$is_mobile) { $mytext = get_comment_text( $comment ) . '<p style="border-top: 1px solid #0C14F0; margin: 30px 0 0 0; padding: 2px 0 0 0;"><small>Not Posted From a Mozilla Agent!</small>'; return $mytext; } else { return $mytext = get_comment_text($comment); } }Geekette, see if you can use the Mac version of HTML Validator here.
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedSweet. Good show!
Now to brush up on my regex, which I never really learned properly in the first place! 😉
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedWell, I may give it a go starting tonight. Sort of new territory for me so we’ll see how it goes.
Thanks for the advice t31os. I’ll post back if I hit a snag. 😉
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedAhhh, nice t31os. You posted while I was writing mine.
I’m going to take a look at that tonight. Looks like a great idea.
Would love to get this working just for my own experience.
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedAm I thinking about this right? You could come at this two ways.
Either:
1) You need to “mark” (storing in the database) a comment made from the mobile phone and then use a filter to add the text to any “marked” comments. (I don’t know anything about storing to database — would love some resources or examples.)
–OR–
2) You need actually change the comment text in the database at the time of posting from the mobile, and in this way avoid having to “mark” the comment for the filter.
I have a feeling #2 would not be recommended, but I’m not sure.
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedI looked at storing some sort of marker in the database but I’ve never coded that type of thing so it’s just a bit beyond me at this point.
As far as I can tell, MobilePress should actually do the job of determining if a user is accessing from a mobile device — it even passes this status through variables. And it does some things with it’s own database tables. But as far as I could tell it doesn’t maintain any connection between this status and a comment made under that status.
Which, according to my newbie coding brain, meant I had no easy way (like checking for comment_author or comment_ID, etc.) to track a comment made from a mobile.
Forum: Plugins
In reply to: [Plugin: WP Private Messages] Any widgets, notifications on web side?Will this plugin continue to be developed?
Forum: Fixing WordPress
In reply to: Automatically adding text to comment after comment is submittedOk, nemo-maritime.
About the best I could do for you is a workaround that only functioned for you. What I mean is that you could create a separate “mobile” login name and post comments from your mobile phone using that login, and I could write a filter that appended the text only to that login’s comments.
But I think the ideal solution — detecting when a comment is made from the mobile version and then remembering that the comment was made from the mobile and displaying as such in the future no matter which version of the site you’re using — is a bit beyond my current coding ability.
Perhaps t3los, stvwlf, Michaelh, or any of the other coding gurus around here have some ideas.
Sorry I couldn’t get it done for ya’.
Forum: Requests and Feedback
In reply to: Updating user status on login and logout.This is far beyond my current coding ability but have you checked out plugins to see how they might do it?
It sounds like you’re looking for some different functionality than the plugin I use to show who’s currently online, but maybe it’ll help. The plugin is WP-UserOnline.
If this doesn’t help at all, sorry to waste your time. 🙂
Forum: Everything else WordPress
In reply to: should I be using WordPressYou can check out the WordPress.org Showcase page for many examples of non-blog sites.
Forum: Fixing WordPress
In reply to: A page per author listing all his/her postsIf you want to go the category route, you’d have to do it like so:
- Create the two categories and have each author post to the respective category
- Create two new pages called Bruce and Clark
- List only posts of category “Bruce” on the Bruce page. You do this by assigning a template to the page and then coding a custom query, or you could use a plugin but you’ll have less control over how the posts display than if you code it yourself. You’d do the same for the Clark page.
I don’t know what your further goals would be but you may also want to hide those categories from the front page (plugin or hard-code).
It seems to me, though, you maybe could just use the author template and link to it in your navigation.