punchlines
Forum Replies Created
-
Got it.. thanks
Thanks for the info. I don’t know what backticks are or how to insert them.
The code posted is not meant for anything other than viewing, so I’m not concerned about usability. I didn’t see any trouble reading it. Can you highlight some areas that you weren’t able to read, pls?
Why is there concern about my sign off name? Are there rules about it?
Thanks
FForum: Fixing WordPress
In reply to: Purpose of addComment.moveFormI got it figured out… thanks
Forum: Fixing WordPress
In reply to: Purpose of addComment.moveFormJacob… I’m struggling to obtain the comment_id of the parent of the reply. I’d like to place it’s value in an innerHTML of a div that I’ve included on the page, when the ‘Reply’ link is clicked.
If addcomment.moveform is removed via onclick=”, the page refresh includes the comment_id as a param in the URL, as in: http://mysite.com/nespresso/?replytocom=358#respond.
I can then use javascript to pull out the comment_id and use it.
But if I leave onclick as it is, and use moveform, there is, of course, no page refresh, hence no opportunity to get the comment_id.
I’m desperate to get that parent id. As mentioned, I’d like it stuffed into a div on the page.
Do you have any way I can get it?
Thanks,
FredForum: Fixing WordPress
In reply to: Purpose of addComment.moveFormThanks, Jacob..
Fred
Forum: Fixing WordPress
In reply to: Purpose of addComment.moveFormSorry, I should also have shown the other edit:
>>>>> $onclick = ”;
$link = sprintf( “%s“,
esc_url( add_query_arg( ‘replytocom’, $comment->comment_ID, get_permalink( $post->ID ) ) ) . “#” . $args[‘respond_id’],
$onclick,
esc_attr( sprintf( $args[‘reply_to_text’], $comment->comment_author ) ),
$args[‘reply_text’]
);It seems that the only difference is that the URL doesn’t show the “replytocom=” id parameters when the full onclick event is allowed. When I set onclick to ”, “replytocom=” etc. parameter shows in the URL.
Example: This is what shows when onclick is ”:
http://mysite.com/nespresso/?replytocom=384#respond
This is what shows when the full onclick “return addComment.moveForm” etc. is used:
Is this a problem?
Thanks
FredAnd… this works to fetch the page id”
onclick=”editMe(‘. $post_id .’)”
But none of the other suggestions seem to work. They all return “undefined”.
Any help would be mostttttt appreciated 🙂
Fred
Correction:
<script><div style=”visibility:visible” id=”divCommentID”></div></script>
I’ll try to understand your info. Thanks for that..
But here’s what’s peeing me off: In the HTML, the number I want is readily apparent – number 381, as a parameter being passed in the reply onclick event:
<div class="reply"><a rel='nofollow'>381</strong>#respond' onclick='return addComment.moveForm( "div-comment-381", "<strong>381</strong>", "respond", "2956" )' aria-label='Reply to Fred to Fred D'>Reply to Fred</a></div></article><!-- .comment-body --></li><!-- #comment-## -->If I could modify the onclick event ‘return addComment.moveForm(‘ in comment-template.php so that it also put the value into a special <div> I have on the page, all would be solved. I could then read the innerHTML of that div in javascript:
I have this div on the page:
</script><div style="visibility:visible" id="divCommentID"></div></script>So if there’s a way to update innerHTML at the same time as the onclick event is fired, I can then easily read the innerHTML in a js call.
Do you have any suggestions how I can do this?
Thanks
Fred- This reply was modified 8 years, 9 months ago by bcworkz. Reason: code fixed
Forum: Developing with WordPress
In reply to: Show $post_id via javascript functionThanks, but that doesn’t work either.
Here’s what I have:
function getJSPostID() {
try {
var test=”<?php print $post_id; ?>”;
return test;
} catch (e) {
return “unavailable”;
}
}function showMe() {
var ID = getJSPostID();
alert(“ID is ” + ID);and here’s what happens:

Fred
Thank you for your reply. get_the_ID() doesn’t return the comment_id.
Can you show me how to get the comment_id of the parent comment for the active reply? Even if get_the_ID() worked, it would return the ID of the current comment, which is the reply, not the parent. And, of course, since the reply has not yet been posted, it would return zero.
This should be simple. For example, I can readily get the $postID of the page simply this way: echo $post_id;
So I would have thought that, if $comment_id is a valid variable (which it is, of course), then there must be an equally simple way to grab it. I’m just not experienced in PHP as I’d like to be, particularly how to pass PHP variables to a javascript call.
Thanks
PunchThat worked @tokkonopapa.
I’ll test again tomorrow to make sure.
Thanks,
Punch- This reply was modified 9 years, 5 months ago by punchlines.
Nope… sorry, but the same problem. Is there anything I can do to demonstrate?
Regards,
Punch- This reply was modified 9 years, 5 months ago by punchlines. Reason: Name
Hi,
Thanks for your quick response.
No, I’m not running any plugins like that. Sorry. Reminder: it only happens when a user is logged in. Otherwise, the link displays in the current window.
I will try the .JS
Thanks
Punch