diff --git src/bp-activity/bp-activity-template.php src/bp-activity/bp-activity-template.php
index e73a259..ba3c58c 100644
|
|
function bp_activity_per_page() { |
993 | 993 | return apply_filters( 'bp_get_activity_per_page', (int) $activities_template->pag_num ); |
994 | 994 | } |
995 | 995 | |
| 996 | |
| 997 | function bp_activity_whats_new_placeholder() { |
| 998 | echo bp_get_activity_whats_new_placeholder(); |
| 999 | } |
| 1000 | |
| 1001 | function bp_get_activity_whats_new_placeholder() { |
| 1002 | $placeholder = sprintf( __( "What's new, %s?", 'buddypress' ), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); |
| 1003 | |
| 1004 | if ( bp_is_group() ) { |
| 1005 | $placeholder = sprintf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); |
| 1006 | } |
| 1007 | |
| 1008 | return apply_filters( 'bp_get_activity_whats_new_placeholder', $placeholder ); |
| 1009 | } |
| 1010 | |
996 | 1011 | /** |
997 | 1012 | * Output the activities title. |
998 | 1013 | * |
diff --git src/bp-templates/bp-legacy/buddypress/activity/post-form.php src/bp-templates/bp-legacy/buddypress/activity/post-form.php
index 12023a8..eca55e4 100644
|
|
|
26 | 26 | </a> |
27 | 27 | </div> |
28 | 28 | |
29 | | <p class="activity-greeting"><?php if ( bp_is_group() ) |
30 | | printf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); |
31 | | else |
32 | | printf( __( "What's new, %s?", 'buddypress' ), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); |
33 | | ?></p> |
34 | | |
35 | 29 | <div id="whats-new-content"> |
| 30 | |
36 | 31 | <div id="whats-new-textarea"> |
37 | | <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10" |
| 32 | <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="1" |
38 | 33 | <?php if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; ?> |
39 | | ><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea> |
| 34 | placeholder="<?php echo esc_attr( bp_get_activity_whats_new_placeholder() ) ;?>"><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea> |
40 | 35 | </div> |
41 | 36 | |
42 | | <div id="whats-new-options"> |
43 | | <div id="whats-new-submit"> |
44 | | <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php esc_attr_e( 'Post Update', 'buddypress' ); ?>" /> |
45 | | </div> |
| 37 | <div id="whats-new-actions"> |
| 38 | <?php |
| 39 | /** |
| 40 | * Fires before the activity post form options. |
| 41 | * |
| 42 | * @since BuddyPress (2.4.0) |
| 43 | */ |
| 44 | do_action( 'bp_activity_post_form_before_options' ); ?> |
46 | 45 | |
47 | | <?php if ( bp_is_active( 'groups' ) && !bp_is_my_profile() && !bp_is_group() ) : ?> |
| 46 | <div id="whats-new-options"> |
48 | 47 | |
49 | | <div id="whats-new-post-in-box"> |
| 48 | <?php if ( bp_is_active( 'groups' ) && !bp_is_my_profile() && !bp_is_group() ) : ?> |
50 | 49 | |
51 | | <?php _e( 'Post in', 'buddypress' ); ?>: |
| 50 | <div id="whats-new-post-in-box"> |
52 | 51 | |
53 | | <select id="whats-new-post-in" name="whats-new-post-in"> |
54 | | <option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option> |
| 52 | <?php _e( 'Post in', 'buddypress' ); ?>: |
55 | 53 | |
56 | | <?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0&update_meta_cache=0' ) ) : |
57 | | while ( bp_groups() ) : bp_the_group(); ?> |
| 54 | <select id="whats-new-post-in" name="whats-new-post-in"> |
| 55 | <option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option> |
58 | 56 | |
59 | | <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> |
| 57 | <?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0&update_meta_cache=0' ) ) : |
| 58 | while ( bp_groups() ) : bp_the_group(); ?> |
60 | 59 | |
61 | | <?php endwhile; |
62 | | endif; ?> |
| 60 | <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> |
63 | 61 | |
64 | | </select> |
65 | | </div> |
66 | | <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> |
| 62 | <?php endwhile; |
| 63 | endif; ?> |
67 | 64 | |
68 | | <?php elseif ( bp_is_group_home() ) : ?> |
| 65 | </select> |
| 66 | </div> |
| 67 | <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> |
69 | 68 | |
70 | | <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> |
71 | | <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> |
| 69 | <?php elseif ( bp_is_group_home() ) : ?> |
72 | 70 | |
73 | | <?php endif; ?> |
| 71 | <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> |
| 72 | <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> |
74 | 73 | |
75 | | <?php |
| 74 | <?php endif; ?> |
76 | 75 | |
| 76 | <?php |
| 77 | |
| 78 | /** |
| 79 | * Fires at the end of the activity post form options. |
| 80 | * |
| 81 | * @since BuddyPress (1.2.0) |
| 82 | */ |
| 83 | do_action( 'bp_activity_post_form_options' ); ?> |
| 84 | |
| 85 | </div><!-- #whats-new-options --> |
| 86 | |
| 87 | <?php |
77 | 88 | /** |
78 | | * Fires at the end of the activity post form markup. |
| 89 | * Fires before the activity post form submit. |
79 | 90 | * |
80 | | * @since BuddyPress (1.2.0) |
| 91 | * @since BuddyPress (2.4.0) |
81 | 92 | */ |
82 | | do_action( 'bp_activity_post_form_options' ); ?> |
| 93 | do_action( 'bp_activity_post_form_before_submit' ); ?> |
| 94 | |
| 95 | <div id="whats-new-submit"> |
| 96 | |
| 97 | <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php esc_attr_e( 'Post Update', 'buddypress' ); ?>" /> |
83 | 98 | |
84 | | </div><!-- #whats-new-options --> |
| 99 | <?php |
| 100 | /** |
| 101 | * Fires at the end of the activity post form submit. |
| 102 | * |
| 103 | * @since BuddyPress (2.4.0) |
| 104 | */ |
| 105 | do_action( 'bp_activity_post_form_submit' ); ?> |
| 106 | </div><!-- #whats-new-submit --> |
| 107 | </div><!-- #whats-new-actions --> |
85 | 108 | </div><!-- #whats-new-content --> |
86 | 109 | |
87 | 110 | <?php wp_nonce_field( 'post_update', '_wpnonce_post_update' ); ?> |
diff --git src/bp-templates/bp-legacy/css/buddypress.css src/bp-templates/bp-legacy/css/buddypress.css
index 1957cef..1df06ff 100644
|
|
Hello, this is the BuddyPress Legacy stylesheet. |
127 | 127 | color: #555; |
128 | 128 | font-family: inherit; |
129 | 129 | font-size: medium; |
130 | | height: 20px; |
131 | 130 | padding: 6px; |
132 | | width: 98%; |
| 131 | width: 97.5%; |
| 132 | resize: none; |
| 133 | overflow: hidden; |
133 | 134 | } |
134 | 135 | body.no-js #buddypress form#whats-new-form textarea { |
135 | 136 | height: 50px; |
| 137 | resize: vertical; |
| 138 | overflow: auto; |
136 | 139 | } |
137 | 140 | #buddypress form#whats-new-form #whats-new-options select { |
138 | 141 | max-width: 200px; |
… |
… |
body.no-js #buddypress form#whats-new-form textarea { |
142 | 145 | float: right; |
143 | 146 | margin-top: 12px; |
144 | 147 | } |
| 148 | |
145 | 149 | #buddypress #whats-new-options { |
146 | 150 | overflow: auto; |
147 | | height: 0; |
| 151 | height: auto; |
| 152 | float:left; |
| 153 | } |
| 154 | |
| 155 | #buddypress #whats-new-content #whats-new-actions { |
| 156 | height:0; |
| 157 | } |
| 158 | |
| 159 | #buddypress #whats-new-content.active #whats-new-actions { |
| 160 | width:auto; |
148 | 161 | } |
| 162 | |
149 | 163 | body.no-js #buddypress #whats-new-options { |
150 | 164 | height: auto; |
151 | 165 | } |
… |
… |
body.no-js #buddypress #whats-new-options { |
154 | 168 | outline-color: rgba(31, 179, 221, 0.9); |
155 | 169 | } |
156 | 170 | |
| 171 | #buddypress #whats-new-content, #buddypress #whats-new-actions { |
| 172 | overflow: hidden; |
| 173 | } |
| 174 | |
157 | 175 | /*-------------------------------------------------------------- |
158 | 176 | 3.1.1 - Activity Listing |
159 | 177 | --------------------------------------------------------------*/ |
diff --git src/bp-templates/bp-legacy/js/buddypress.js src/bp-templates/bp-legacy/js/buddypress.js
index 4c5e139..5683791 100644
|
|
jq(document).ready( function() { |
32 | 32 | if ( $whats_new.length && bp_get_querystring('r') ) { |
33 | 33 | var $member_nicename = $whats_new.val(); |
34 | 34 | |
35 | | jq('#whats-new-options').animate({ |
36 | | height:'50px' |
37 | | }); |
38 | | |
39 | | $whats_new.animate({ |
40 | | height:'50px' |
| 35 | jq('#whats-new-actions').animate({ |
| 36 | height:'100%' |
41 | 37 | }); |
42 | 38 | |
43 | 39 | jq.scrollTo( $whats_new, 500, { |
… |
… |
jq(document).ready( function() { |
52 | 48 | |
53 | 49 | /* Textarea focus */ |
54 | 50 | $whats_new.focus( function(){ |
55 | | jq('#whats-new-options').animate({ |
56 | | height:'50px' |
57 | | }); |
58 | | jq('#whats-new-form textarea').animate({ |
59 | | height:'50px' |
| 51 | jq('#whats-new-actions').animate({ |
| 52 | height:'100%' |
60 | 53 | }); |
| 54 | |
61 | 55 | jq('#aw-whats-new-submit').prop('disabled', false); |
62 | 56 | |
63 | 57 | jq( '#whats-new-content' ).addClass( 'active' ); |
… |
… |
jq(document).ready( function() { |
88 | 82 | if ( document.activeElement !== this ) { |
89 | 83 | if (!this.value.match(/\S+/)) { |
90 | 84 | this.value = ''; |
91 | | jq('#whats-new-options').animate({ |
| 85 | jq('#whats-new-actions').animate({ |
92 | 86 | height:'0' |
93 | 87 | }); |
94 | | jq('form#whats-new-form textarea').animate({ |
95 | | height:'20px' |
96 | | }); |
| 88 | |
| 89 | jq('#whats-new-form textarea').css( { |
| 90 | height:'auto' |
| 91 | } ); |
| 92 | |
97 | 93 | jq('#aw-whats-new-submit').prop('disabled', true); |
98 | 94 | jq( '#whats-new-content' ).removeClass( 'active' ); |
99 | 95 | } |
100 | 96 | } |
101 | 97 | }); |
102 | 98 | |
| 99 | /* Texarea auto-resize */ |
| 100 | $whats_new.on( 'keyup', function( event ) { |
| 101 | var self = jq( this ); |
| 102 | |
| 103 | if ( this.scrollHeight <= self.innerHeight() ) { |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | self.css( { |
| 108 | height: this.scrollHeight + 'px' |
| 109 | } ); |
| 110 | } ); |
| 111 | |
103 | 112 | /* New posts */ |
104 | 113 | jq('#aw-whats-new-submit').on( 'click', function() { |
105 | 114 | var last_date_recorded = 0, |
106 | 115 | button = jq(this), |
107 | | form = button.closest('form#whats-new-form'); |
| 116 | form = button.closest('form#whats-new-form'), |
| 117 | inputs = {}, post_data; |
| 118 | |
| 119 | // Get all inputs and organize them into an object {name: value} |
| 120 | jq.each( form.serializeArray(), function( key, input ) { |
| 121 | // Only include public extra data |
| 122 | if ( '_' !== input.name.substr( 0, 1 ) && 'whats-new' !== input.name.substr( 0, 9 ) ) { |
| 123 | if ( ! inputs[ input.name ] ) { |
| 124 | inputs[ input.name ] = input.value; |
| 125 | } else { |
| 126 | // Checkboxes/dropdown list can have multiple selected value |
| 127 | if ( ! jq.isArray( inputs[ input.name ] ) ) { |
| 128 | inputs[ input.name ] = new Array( inputs[ input.name ], input.value ); |
| 129 | } else { |
| 130 | inputs[ input.name ].push( input.value ); |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } ); |
108 | 135 | |
109 | | form.children().each( function() { |
110 | | if ( jq.nodeName(this, 'textarea') || jq.nodeName(this, 'input') ) { |
| 136 | form.find( '*' ).each( function() { |
| 137 | if ( jq.nodeName( this, 'textarea') || jq.nodeName( this, 'input' ) ) { |
111 | 138 | jq(this).prop( 'disabled', true ); |
112 | 139 | } |
113 | | }); |
| 140 | } ); |
114 | 141 | |
115 | 142 | /* Remove any errors */ |
116 | 143 | jq('div.error').remove(); |
… |
… |
jq(document).ready( function() { |
145 | 172 | object = jq('#whats-new-post-object').val(); |
146 | 173 | } |
147 | 174 | |
148 | | jq.post( ajaxurl, { |
149 | | action: 'post_update', |
150 | | 'cookie': bp_get_cookies(), |
151 | | '_wpnonce_post_update': jq('#_wpnonce_post_update').val(), |
152 | | 'content': content, |
153 | | 'object': object, |
154 | | 'item_id': item_id, |
155 | | 'since': last_date_recorded, |
156 | | '_bp_as_nonce': jq('#_bp_as_nonce').val() || '' |
157 | | }, |
158 | | function(response) { |
| 175 | // Include the public data to the post data |
| 176 | post_data = jq.extend( { |
| 177 | action : 'post_update', |
| 178 | 'cookie' : bp_get_cookies(), |
| 179 | '_wpnonce_post_update' : jq('#_wpnonce_post_update').val(), |
| 180 | 'content' : content, |
| 181 | 'object' : object, |
| 182 | 'item_id' : item_id, |
| 183 | 'since' : last_date_recorded, |
| 184 | '_bp_as_nonce' : jq('#_bp_as_nonce').val() || '', |
| 185 | }, inputs ); |
159 | 186 | |
160 | | form.children().each( function() { |
161 | | if ( jq.nodeName(this, 'textarea') || jq.nodeName(this, 'input') ) { |
162 | | jq(this).prop( 'disabled', false ); |
| 187 | jq.post( ajaxurl, post_data, function( response ) { |
| 188 | |
| 189 | form.find( '*' ).each( function() { |
| 190 | if ( jq.nodeName( this, 'textarea') || jq.nodeName( this, 'input' ) ) { |
| 191 | jq( this ).prop( 'disabled', false ); |
163 | 192 | } |
164 | | }); |
| 193 | } ); |
165 | 194 | |
166 | 195 | /* Check for errors and append if found. */ |
167 | 196 | if ( response[0] + response[1] === '-1' ) { |
… |
… |
jq(document).ready( function() { |
204 | 233 | |
205 | 234 | jq('li.new-update').hide().slideDown( 300 ); |
206 | 235 | jq('li.new-update').removeClass( 'new-update' ); |
207 | | jq('#whats-new').val(''); |
| 236 | |
| 237 | // Reset the form |
| 238 | form.get(0).reset(); |
208 | 239 | |
209 | 240 | // reset vars to get newest activities |
210 | 241 | newest_activities = ''; |
211 | 242 | activity_last_recorded = 0; |
212 | 243 | } |
213 | 244 | |
214 | | jq('#whats-new-options').animate({ |
| 245 | jq('#whats-new-actions').animate({ |
215 | 246 | height:'0px' |
216 | 247 | }); |
217 | | jq('#whats-new-form textarea').animate({ |
218 | | height:'20px' |
219 | | }); |
| 248 | |
220 | 249 | jq('#aw-whats-new-submit').prop('disabled', true).removeClass('loading'); |
221 | 250 | jq( '#whats-new-content' ).removeClass( 'active' ); |
222 | | }); |
| 251 | } ); |
223 | 252 | |
224 | 253 | return false; |
225 | 254 | }); |