Index: src/bp-core/classes/class-bp-button.php
===================================================================
--- src/bp-core/classes/class-bp-button.php	(revision 11016)
+++ src/bp-core/classes/class-bp-button.php	(working copy)
@@ -33,8 +33,18 @@
  *                                          Default: ''.
  *     @type string      $wrapper_class     Optional. DOM class of the button wrapper
  *                                          element. Default: ''.
+ *     @type string      $li_class          Optional: Available if $wrapper set to ul & li elements created
+ *                                          Default: ''.
+ *     @type string      $element           Optional. The type of element to use e.g 'anchor', 'button'
+ *                                          Default: 'anchor'.
+ *     @type string      $button_type       Optional. Set the button type i.e like input types
+ *                                          Defaults to 'button' [type="button"] can be 'submit' [type="submit"]
+ *     @type string      $button_name       Optional: Button 'name' value - if type == 'submit'.
+ *     @type string      $button_value      Optional: Button 'value' value - if type == 'submit'.
  *     @type string      $link_href         Optional. Destination link of the button.
  *                                          Default: ''.
+ *     @type string      $data_attr         Optional. Allow a data attributte to be set. e.g 'data-bp-buttons=""'
+ *                                          Default: ''.
  *     @type string      $link_class        Optional. DOM class of the button. Default: ''.
  *     @type string      $link_id           Optional. DOM ID of the button. Default: ''.
  *     @type string      $link_rel          Optional. DOM 'rel' attribute of the button.
@@ -82,7 +92,7 @@
 	/**
 	 * The type of DOM element to use for a wrapper.
 	 *
-	 * @var string|bool 'div', 'span', 'p', 'li', or false for no wrapper.
+	 * @var string|bool 'div', 'ul',  'p', 'span' or false for no wrapper.
 	 */
 	public $wrapper = 'div';
 
@@ -100,9 +110,50 @@
 	 */
 	public $wrapper_id = '';
 
+	/**
+	 * The DOM class of li child elements the wrapper as a ul.
+	 *
+	 * @var string
+	 */
+
+	public $li_class = '';
+
 	/** Button ****************************************************************/
 
 	/**
+	* The node element type type i.e. a true '<button>' element or '<a>' anchor:
+	* 'button', 'anchor'
+	*
+	* @var string
+	*/
+	public $element = 'anchor';
+
+	/**
+	* The button elements type i.e. 'submit', 'button'.
+	*
+	*
+	* @var string
+	*/
+	public $button_type = 'button';
+
+	/**
+	* The button elements name attr i.e. 'name=""'.
+	*
+	*
+	* @var string
+	*/
+	public $button_name = '';
+
+	/**
+	* The button elements value attr i.e. 'value=""'.
+	*
+	*
+	* @var string
+	*/
+	public $button_value = '';
+
+
+	/**
 	 * The destination link of the button.
 	 *
 	 * @var string
@@ -138,6 +189,13 @@
 	public $link_title = '';
 
 	/**
+	 * A data attribute.
+	 *
+	 * @var string
+	 */
+	public $data_attr = '';
+
+	/**
 	 * The contents of the button link.
 	 *
 	 * @var string
@@ -163,6 +221,8 @@
 
 		$r = wp_parse_args( $args, get_class_vars( __CLASS__ ) );
 
+		//return var_dump($r);
+
 		// Required button properties.
 		$this->id                = $r['id'];
 		$this->component         = $r['component'];
@@ -202,19 +262,29 @@
 		// Wrapper properties.
 		if ( false !== $this->wrapper ) {
 
+
+			// If 'ul' is set for $wrapper we'll automagically create the mandatory
+			// 'li' elements & add class tokens if args !empty
+			if( 'li' == $this->wrapper ) {
+				if( !empty( $r['li_class'] ) ) $this->li_class = ' class="' . $r['li_class'] . '"';
+			}
+
 			// Wrapper ID.
 			if ( !empty( $r['wrapper_id'] ) ) {
-				$this->wrapper_id    = ' id="' . $r['wrapper_id'] . '"';
+				$this->wrapper_id  = ' id="' . $r['wrapper_id'] . '"';
 			}
 
 			// Wrapper class.
-			if ( !empty( $r['wrapper_class'] ) ) {
-				$this->wrapper_class = ' class="generic-button ' . $r['wrapper_class'] . '"';
+			if ( !empty( $r['wrapper_class'] ) && 'li' !== $this->wrapper ) {
+						$this->wrapper_class = ' class="generic-button ' . $r['wrapper_class'] . '"';
+			} elseif( 'li' == $this->wrapper ) {
+						if( !empty( $r['li_class'] ) ) $this->wrapper_class = ' class="generic-button ' . $r['li_class'] . '"';
 			} else {
 				$this->wrapper_class = ' class="generic-button"';
 			}
 
 			// Set before and after.
+			// Include 'li' elements if wrapper = 'ul'
 			$before = '<' . $r['wrapper'] . $this->wrapper_class . $this->wrapper_id . '>';
 			$after  = '</' . $r['wrapper'] . '>';
 
@@ -223,16 +293,43 @@
 			$before = $after = '';
 		}
 
-		// Link properties.
+
+		// Link/Button  properties.
+		//if ( !empty( $r['element']    ) ) $this->element    =
+		if ( !empty( $r['button_type']  )  && 'button' == $r['element'] ) $this->button_type = ' type="' . $r['button_type'] . '"';
+		if ( !empty( $r['button_name']  )  && 'button' == $r['element'] && 'submit' == $r['button_type'] ) $this->button_name = ' name="' . $r['button_name'] . '"';
+		if ( !empty( $r['button_value'] )  && 'button' == $r['element'] && 'submit' == $r['button_type'] ) $this->button_value = ' value="' . $r['button_value'] . '"';
 		if ( !empty( $r['link_id']    ) ) $this->link_id    = ' id="' .    $r['link_id']    . '"';
+		// No href if we're a button please!
 		if ( !empty( $r['link_href']  ) ) $this->link_href  = ' href="' .  $r['link_href']  . '"';
 		if ( !empty( $r['link_title'] ) ) $this->link_title = ' title="' . $r['link_title'] . '"';
 		if ( !empty( $r['link_rel']   ) ) $this->link_rel   = ' rel="' .   $r['link_rel']   . '"';
 		if ( !empty( $r['link_class'] ) ) $this->link_class = ' class="' . $r['link_class'] . '"';
-		if ( !empty( $r['link_text']  ) ) $this->link_text  =              $r['link_text'];
+		if ( !empty( $r['data_attr']  ) ) $this->data_attr  = ' ' . $r['data_attr'] ;
+		if ( !empty( $r['link_text']  ) ) $this->link_text  =   $r['link_text'];
 
+		// The wrapper element
+
+		// The element tag: e.g '<a', '<button'
+
+		if ( 'button' == $r['element'] ) {
+
+			// If the button type is submit we'll build the button form controls attr here
+			if( 'submit' == $r['button_type'] ) {
+				$button_controls = $this->button_name . $this->button_value ;
+			}
+
+			$before_element = '<button ' . $this->button_type . $button_controls;
+			$after_element  = '</button>';
+
+		} else {
+			$before_element = '<a ' . $this->link_href;
+			$after_element  = '</a>';
+		}
+
 		// Build the button.
-		$this->contents = $before . '<a'. $this->link_href . $this->link_title . $this->link_id . $this->link_rel . $this->link_class . '>' . $this->link_text . '</a>' . $after;
+		// attr here can be applicable/common to anchors or button elements
+		$this->contents = $before . $before_element . $this->link_title . $this->link_id . $this->link_rel . $this->data_attr . $this->link_class . '>' . $this->link_text . $after_element . $after;
 
 		/**
 		 * Filters the button based on class parameters.
@@ -246,8 +343,10 @@
 		 * @param BP_Button $this     Current BP_Button instance.
 		 * @param string    $before   HTML appended before the actual button.
 		 * @param string    $after    HTML appended after the actual button.
+		 * @param string    $before_element  Actual items opening element.
+		 * @param string    $after_element   Actual items closing element t& tag .
 		 */
-		$this->contents = apply_filters( 'bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after );
+		$this->contents = apply_filters( 'bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after, $before_element, $after_element );
 	}
 
 	/**
