Forum Replies Created
-
Got it 🙂 problem was the $cat_id
$category = get_the_category($post_id); bp_activity_add( array( 'user_id' => (int) $post->post_author, 'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, $post, $post_permalink ), 'content' => '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', 'primary_link' => $post_permalink, 'component' => 'groups', 'type' => 'activity_update', 'item_id' => $category[0]->cat_ID, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false ) );
[solved]
I have this within the bp_blogs_record_post function. Ofcourse its not working, can somebody help me on the right track please, thank you very much $cat_id is same id as the group id.
`bp_activity_add( array( ‘user_id’ =>’2′,
‘action’ => ‘New Post’,
‘content’ => ‘<a href=”‘ . $post_permalink . ‘”>’ . $post->post_title . ‘</a>’,
‘primary_link’ => $post_permalink,
‘component’ => ‘groups’,
‘type’ => ‘activity_update’,
‘item_id’ => $cat_id,
‘recorded_time’ => bp_core_current_time(),
‘hide_sitewide’ => false ) );`Can somebody tell me where I can find the part the records the activity for posts ?
I would like to modify the part that inserts activity when a post is created.
Go to pages -> Trash -> empty all pages from trash
And in the page make sure the permlink says groups and not groups-2 (edit if needed)edit -> ok -> update page
Found problem for my first question, dont have the answer it though
Undefined property: BP_Groups_Component::$table_name
Well basicly you can add conditions or remove conditions.
if (!is_user_logged_in) { echo "your link"; }
so without the else, there is no else, and will not echo out anything if it does not match your condition.
You can read about it here http://php.net/manual/en/control-structures.else.php and here http://php.net/manual/en/language.operators.comparison.php not really rocket science so easy to understand
And the Lost link, are hardcoded in the wp core.. however i suggest you do not go there.. but ask somebody that can do it for you..
Nice.. I am glad it all Finally worked out for ya 🙂
There you go…
When you copy and paste code from here the “<– Quotation marks like those are copy and pasted wrongly!
Ill adjust your text widget with your register code 🙂 give me a few secsAll done 🙂 Have fun!
Yes I did, and replied, its not the code, but rather the code in your text widget.
You probably used something like echo (bloginfo(‘url’) . ‘ which will echo out http, eval and http will have problems so you have to use something like /register-2/ insteadOk updated your functions.php, you added the code after the ?> closing tag at the bottom of your functions.php so, whatever php code you put in your widget would still not be parsed.
Now can do a simple test by just creating a text widget with the following
<?php
echo “Yes, php parsing works”;
?>If the output of that is Yes, php parsing works without the echo” “; part You are set 🙂
Or give me access to your admin panel (temporary)
Can you send me your functions.php ? ol4pro at gmail.com (zip it first)
@mercime What if I gave the Groups the same ID as the Categories and then treat all new_blog_posts as an activity_update using Category id as Group id using the bp_activity_add() ? would that be possible ?
That way, they are just Activity / Wall posts assigned to the group, instead of creating a whole new set of links around the website as done with the “blog categories for groups”
That plugin will not insert it into the Activity of a Group but put it into a newly created link on the user navigaiton menu “Blog” http://domain.com/groups/artistas-musica/blog <–
Is there a hack available for making it go straight the the Activity of Group ?
Change the the http part, in
echo "<a href='/register-2/'>Register</a>";
so it becomes this using http will give problems do to the eval()
<?php if ( !is_user_logged_in() ) { /* if the user != logged in */ echo "<a href='/register-2/'>Register</a>"; /* echo the link*/ } else { /* else if user is logged in */ echo "Welcome Back"; } /* closing the if else statement */ ?>
Don’t worry,
The first part what you added in functions.php will make sure that we can put in php code into the Text Widget, this is normally not allowed. It will simply not parse the php code. And that is the reason why u don not see the desired results on your screen.
So now you can add a Text Widget and put in PHP code
So now the notice when a user is or is not logged in. In php ! means IS NOT as in !=, so here we go with your code
<?php if ( !is_user_logged_in() ) { /* if the user != logged in */ echo "<a href='http://www.disqusnow.co.uk/register-2/'>Register</a>"; /* echo the link*/ } else { /* else if user is logged in */ echo "Welcome Back"; } /* closing the if else statement */ ?>
Dumb was me, did not read correctly your question (sorry) updated my answer 11 minutes ago, try that, I tested it locally and works fine 🙂 the echo part you can change with your register code.
like
echo '<a href="#">LINK</a>';
I put this on the side bar using the text widget.
Sorry I think, I see what you are trying to do, you are using a default Text Widget from wp admin-> Appearance -> Widgets -> A text Widget with the code you posted?
If so you can do the following
/wp-content/themes/YOURTHEME/fucntions.php (create functions.php it if does not exist)
than add this piece of code to the functions.php
add_filter('widget_text','execute_php',100); function execute_php($html){ if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); $html=ob_get_contents(); ob_end_clean(); } return $html; }
Now you can go to widgets and add a Text Widget to your sidebar and add a code like this
<?php if ( !is_user_logged_in() ) { echo "you are NOT logged in"; } else { echo "you are logged in"; } ?>
Can you post your exact code snippet as you put it, not loading probably means a typo in the code.
You can get an example code from https://codex.wordpress.org/Function_Reference/is_user_logged_in , it pretty straight forward. Not much coding knowledge needed.
And what @hnla means is that <font> tag has been deprecated, so use css something like
<p style="color:#306EFF;">REGISTER HERE</p>
Found the Problem for Media Upload wp 3.5.2 & 1.7.2, plugin Wp User Fronted v1.2.2 is causing the problem
Also is this going to be removed in 1.8 ? Kinda nice of having it (working)
Follow these instructions https://codex.buddypress.org/developer/customizing/customizing-labels-messages-and-urls/
Funcione 🙂
Try doing something like this.
<?php if ( !is_user_logged_in() ) {?> <font color = “#306EFF”>REGISTER</font> <?}?>
Its made in wp-content/plugins/buddypress/bp-groups/bp-groups-template.php starting from line 1766
Line 1027 /wp-content/plugins/buddypress/bp-groups/bp-groups-screens.php
Line 21 /wp-content/plugins/buddypress/bp-themes/bp-default/groups/index.phpI hate to tell you this, but there is not a easy way to do what you want to do. And as far as the code, that will echo out ID / USERNAME, and will execute the remove_action function. But that is all it does.
bp_blogs_record_post function can be found there –> /plugins/buddypress/bp-blogs/bp-blogs-functions.php. However I suggest and of course if you afford it, get a pro to do it for you