Sure,
So I’m displaying the count on my page of a particular membership group utilizing another plugin and my short code looks like this
[gdoc key=”wordpress” query=”SELECT COUNT(membership_level) AS ‘Registered’ FROM ******swpm_members_tbl WHERE membership_level=4″]
*** blurring out my main table name
get that number and its being loaded in a data table on front end with above short code.
I am then using js to get that value in that data table like this and replacing the buy button with a custom message, essentially caping my membership for that level .
<script type=”text/javascript”>
var Row = document.getElementById(“igsv-1-wordpress”);
var Cells = Row.getElementsByTagName(“td”);
var num =(Cells[0].innerText);
console.log(num);
var numf = parseInt(num);
if (numf >= 50) {
alert( “Closed Challenge”);
var x = document.getElementsByClassName(“swpm-payment-button”);
x[0].innerHTML = “Maximum Number Of members”;
}
</script>
Its my quick solution, sure I probably could’ve done it with php or whatever, but this works for me.