bp_dd_import_users_activity()
Import Activity – aka “status updates”.
Description
Return
(int) Number of activity records that were inserted into the database.
Source
File: bp-core/bp-core-tools-default-data.php
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | function bp_dd_import_users_activity() { $count = 0; if ( ! bp_is_active( 'activity' ) ) { return $count ; } $users = bp_dd_get_random_users_ids( 0 ); /** @var $activity array */ require ( BP_DEFAULT_DATA_DIR . 'data/activity.php' ); for ( $i = 0; $i < 75; $i ++ ) { $user = $users [ array_rand ( $users ) ]; $content = $activity [ array_rand ( $activity ) ]; if ( $bp_activity_id = bp_activity_post_update( array ( 'user_id' => $user , 'content' => $content , ) ) ) { $bp_activity = new BP_Activity_Activity( $bp_activity_id ); $bp_activity ->date_recorded = bp_dd_get_random_date( 44 ); if ( $bp_activity ->save() ) { $count ++; } } } return $count ; } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.