| @@ 15-57 (lines=43) @@ | ||
| 12 | * |
|
| 13 | * @since 1.0.0 |
|
| 14 | */ |
|
| 15 | class WordPoints_BP_Entity_Group extends WordPoints_BP_Entity { |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @since 1.0.0 |
|
| 19 | */ |
|
| 20 | protected $bp_component = 'groups'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @since 1.0.0 |
|
| 24 | */ |
|
| 25 | protected $id_field = 'id'; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @since 1.2.1 |
|
| 29 | */ |
|
| 30 | protected $id_is_int = true; |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @since 1.0.0 |
|
| 34 | */ |
|
| 35 | protected $human_id_field = 'name'; |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @since 1.0.0 |
|
| 39 | */ |
|
| 40 | protected function get_entity( $id ) { |
|
| 41 | ||
| 42 | $entity = groups_get_group( $id ); |
|
| 43 | ||
| 44 | if ( ! $entity->id ) { |
|
| 45 | return false; |
|
| 46 | } |
|
| 47 | ||
| 48 | return $entity; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @since 1.0.0 |
|
| 53 | */ |
|
| 54 | public function get_title() { |
|
| 55 | return _x( 'Group', 'group entity', 'wordpoints-bp' ); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | // EOF |
|
| 60 | ||
| @@ 15-62 (lines=48) @@ | ||
| 12 | * |
|
| 13 | * @since 1.0.0 |
|
| 14 | */ |
|
| 15 | class WordPoints_BP_Entity_Message extends WordPoints_BP_Entity { |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @since 1.0.0 |
|
| 19 | */ |
|
| 20 | protected $bp_component = 'messages'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @since 1.0.0 |
|
| 24 | */ |
|
| 25 | protected $bp_component_table_name = 'messages'; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @since 1.0.0 |
|
| 29 | */ |
|
| 30 | protected $id_field = 'id'; |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @since 1.2.1 |
|
| 34 | */ |
|
| 35 | protected $id_is_int = true; |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @since 1.0.0 |
|
| 39 | */ |
|
| 40 | protected $human_id_field = 'subject'; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @since 1.0.0 |
|
| 44 | */ |
|
| 45 | protected function get_entity( $id ) { |
|
| 46 | ||
| 47 | $entity = new BP_Messages_Message( $id ); |
|
| 48 | ||
| 49 | if ( ! $entity->id ) { |
|
| 50 | return false; |
|
| 51 | } |
|
| 52 | ||
| 53 | return $entity; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @since 1.0.0 |
|
| 58 | */ |
|
| 59 | public function get_title() { |
|
| 60 | return _x( 'Message', 'message entity', 'wordpoints-bp' ); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| 64 | // EOF |
|
| 65 | ||