Need help with Custom Code
-
Hi Everyone,
I have a unique issue. I’m using Buddypress with some modifications, and one of the features of the site is a sidestream bar that lists that latest 20 posts. In order to help with styliing and other issues, I created a code that explodes the activity content into parts so i could style accordingly. I made this code for the single activity page, so now my problem is that it only displays the latest activity in all 20 spots.
I need it to be able to get all 20 and explode them all. I tried everything I know and got nowhere. PLEASE HELP!
Heres the custom code I created. The part with $activityDescription = (activityDescription[0]); is where it calls the description for the latest post, if I change the value to 1 it shows the next one and so on..I tried an array with all 20 but still didnt work
`
<?php
global $activities_template;
$activities = $activities_template->activities;
$activity = $activities[0];$activityContent = $activity->content;
if(stripos($activityContent, “[bpfb_images]”))
{
$activityDescription = explode(“[bpfb_images]”, $activityContent);
$activityDescription = ($activityDescription[0]);//var_dump($activityContent);
$images = explode(” “, $activityContent);
for($i=0; $i<sizeof($images);$i++)
{
if(!(stripos($images[$i], “.jpg”) === false) || !(stripos($images[$i], “.png”) === false) || !(stripos($images[$i], “.gif”) === false))
{
$brokenImages =preg_split(‘/s+/’, $images[$i]);
for($k=1;$k<(sizeof($brokenImages)-1);$k++)
{
if(trim($brokenImages[$k]) == “” || !(stripos($brokenImages[$k], “bpfb_”) === false))
continue;$finalURL = $brokenImages[$k];
$finalFULL = $brokenImages[$k];if(!stripos($finalURL, “ttp://”))
{
$finalURL = str_replace(“.j”, “-bpfbt.j”, $brokenImages[$k]);
$finalURL = “(SITE REMOVED)”.$finalURL;
$finalFULL = “(SITE REMOVED)”.$finalFULL;
}
echo ““;
echo ““;
echo ““.bp_get_activity_action().”“;
echo ““.$activityDescription.”
“;
}
}
}
}
else
{
echo ““;
echo ““.bp_get_activity_action().”“;
echo ““.$activityContent.”
“;
}
?>
`I removed the webiste address in (SITE REMOVED) so search engines cant find it right now while its in dev.
THANKS!
- The topic ‘Need help with Custom Code’ is closed to new replies.