comments

Get user Posts and/or Comments in a sharing blog using SQL

浪尽此生 提交于 2019-12-12 03:17:19
问题 This (My)SQL problem will make me crazy if not solved this week-end! A simple shared blog (means many authors contribute). Let's consider that two tables on my database: Posts : id author_id title content Comments : id author_id post_id content Goal: I want to display all the activities of a contributor (=> fixed author_id) . What I mean by activity is: If the user created the post and commented: Display the post title and the user comment If the user created the post but doesn't comment:

Facebook - retrieving comment-count from fb:comments using href?

半城伤御伤魂 提交于 2019-12-12 03:09:20
问题 I've integrated fb:comments using the href parameter, but I am now stuck in a situation where I need to retrieve the comment count without fb:comment-count. I normally use an FQL query such as below... $result = $facebook->api(array( 'query' => 'SELECT post_id FROM comment WHERE xid = "' . $xid . '"', 'method' => 'fql.query')); $comment_count = count($result); However, there is no href column present in the comment table. Is there another way to do this? I have tried seeing if xid and href

How to get all post from a page with count ALL likes and comments?

谁说胖子不能爱 提交于 2019-12-12 02:34:52
问题 attached got a question ... I try with all feeds Likes and Comments retrieve a page during a period. or .. actually I only need the total number of likes and comments overall. So far ... $user_pages = $facebook-> api ('/ me / accounts'); ... $page_feeds = $facebook-> api ("/". $ page_name ['id']. '/ feed', 'GET', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("Y")))); ... foreach ($page_feeds ['data'] as $ page) { $c = $facebook-> api ("/" $ page ['id'] "/ likes",

Is there a way to filter out moderated comments with the graph API?

末鹿安然 提交于 2019-12-12 02:28:42
问题 We use comment moderation, and the graph API is returning everything (including comments that should be hidden). There doesn't appear to be a way to see the status of the comments or filter them out of the results. 回答1: You can use FQL to query only comments that are public. Use the is_private column of comment table to do it (as Ryan says). Let me add some examples: For example to see only public comments: SELECT post_fbid, fromid, object_id, text, time \ FROM comment \ WHERE object_id IN \

Unix/Linux, Delete comments from lines

五迷三道 提交于 2019-12-12 01:36:17
问题 I need to delete/remove comments from a user-input line without deleting any codes. So for example: mail -s 'text' brown < text #comments How do I remove the comments and leave the code intact? I can delete lines that begin with #, but not if it begins somewhere in the middle of the lines. I tried: echo $line | sed -e 's/\ but it does not work. Any idea what I'm doing wrong? Also, how to detect cases in which # is not used to begin a comment? For example quoted # and line of code that ends

Can you give me examples of odd single line comments in C++?

无人久伴 提交于 2019-12-12 01:33:30
问题 I wrote a method to remove single line comments from a C++ source file: def stripRegularComments(text) { def builder = new StringBuilder() text.eachLine { def singleCommentPos = it.indexOf("//") def process = true if(singleCommentPos > -1) { def counter = 0 it.eachWithIndex { obj,i -> if((obj == '\'') || (obj == '"')) counter++ if(i == singleCommentPos) { process = ((counter % 2) == 1) if(!process) return } } if(!process) { def line = it.substring(0,singleCommentPos) builder << line << "\n" }

MYSQl Optimize Table Of Blog Posts With Comments

无人久伴 提交于 2019-12-12 01:18:54
问题 Im making a mysql table which will be holding my blog posts and some of their information. I want to be able to add comments the the blog posts and have them saved in mysql. My question is weather I should make a table called comments and have all the comments there have the blog post id, so I would only select the corresponding comments like this: select from comments where id = blogpostid Or my other idea was to put all the comments in an array, and save them in a longtext field in my blog

Wordpress Text Widget replaces php tags with html comment tags?

泪湿孤枕 提交于 2019-12-12 00:55:44
问题 I am attempting to add some php to a page on my wordpress site in the code editor part of my tiny mce editor. However, whenever type something like: <?php echo "Hello World"; ?> and then save the article, when I next go to edit the article it replaces my php tags with a html comment: <!--?php echo "Hello World"; ?--> Would be very grateful if anyone knows what is going on here and why WordPress is doing this. 回答1: To use PHP code in your content editor, you will either need to install a

retain comments post XSLT transform

て烟熏妆下的殇ゞ 提交于 2019-12-11 16:38:20
问题 This seems like an easy one, but one that I haven't come across before. I need to retain the comments in an XML file to the output XML after applying an XSLT. Does anyone know how/if this is possible? Thanks! 回答1: In your XSL you can reference comments in your source XML similar to other elements, e.g.: <xsl:template match="comment()"> <xsl:value-of select="."/> </xsl:template> If it should appear in your transformed XML as comment as well you can do the following: <xsl:template match=

WP auto comment approve for custom post type

谁都会走 提交于 2019-12-11 15:16:33
问题 I have added the action for auto approve comments for my xyz custom post. But its not working when added the condition if($post_type =='course') . I have tried with also filter. But its not working. How can i solve that? Action: global $post_type; if($post_type =='xyz'){ function action_pre_comment_approved( $array, $int, $int ) { }; add_action( 'pre_comment_approved', 'action_pre_comment_approved', 10, 3 ); } Filter: global $post_type; if($post_type =='xyz'){ function filter_pre_comment