AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] I want to get the body of the post

8 Posts
3 Users
1 Reactions
2,718 Views
Posts: 6
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gocchimama)
Active Member
Joined: 3 years ago
[#50004]

I can get the post title, username and post URL as below, but not the body.
Please give me advice on how to write it.

    $author_id = $post['userid']; 
    $author_name = get_the_author_meta('display_name', $author_id);

    $topic = wpforo_topic($post['topicid']);
    $topic_url = $topic['url'];

    $send_title = esc_html( $post['title'] );

7 Replies
Tutrix
Posts: 1519
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@tutrix)
Noble Member
Joined: 6 years ago

Hi @gocchimama

try

esc_html( wpforo_text( $post['body']) )

or

esc_html( wpforo_content_filter( $post['body']) )

Posts: 6
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gocchimama)
Active Member
Joined: 3 years ago

Thank you !

i tried it ,but it didn't work...


2 Replies
Tutrix
(@tutrix)
Joined: 6 years ago

Noble Member
Posts: 1519
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@gocchimama 

I am using the above codes for a mouseover post preview e.g. in the widgets and it works there.


BlackRaz
Admin
(@blackraz)
Joined: 9 years ago

Contributor
Posts: 396
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@gocchimama 

Try this code for getting body

wpforo_content( $post, false );

Posts: 6
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gocchimama)
Active Member
Joined: 3 years ago

Thank you !

But,I couldn't get it. When I look at the debug, the body does not exist in the array.

Array
(
[topicid] => 37
[forumid] => 2
[first_postid] => 42
[userid] => 1
[title] => this title
[slug] => %e3%81%95%e3%82%89%e3%81%ab%e3
[created] => 2023-07-2608:55:34
[modified] => 2023-07-2608:55:34
[last_post] => 42
[posts] => 1
[votes] => 0
[answers] => 0
[views] => 0
[meta_key] =>
[meta_desc] =>
[type] => 0
[solved] => 0
[closed] => 0
[has_attach] => 0
[private] => 0
[status] => 0
[name] =>
[email] =>
[prefix] =>
[tags] =>
[url] =>  http://forum.local/xxx 
[full_url] =>  http://forum.local/xxx 
[short_url] =>  http://forum.local/topicid/37/ 
)
 
How can I add the 'body' to the array?

BlackRaz
Posts: 396
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@blackraz)
Contributor
Joined: 9 years ago

@gocchimama
You can use this function e.g.

wpforo_topic( $post['topicid'], 'body' )

Page 1 / 2
Share: